Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial issuer.description tests. #48

Merged
merged 6 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

### Added
- Add new tests for `issuer.name` including Internationalization settings.
- A new test to ensure type urls are treated as a unordered set.
- Add a new test to ensure type URLs are treated as an unordered set.
- Add new tests for `issuer.description` including Internationalization settings.
JSAssassin marked this conversation as resolved.
Show resolved Hide resolved

## 1.0.0 - 2023-11-10

Expand Down
17 changes: 17 additions & 0 deletions tests/10-vcdm2.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ describe('Verifiable Credentials Data Model v2.0', function() {
'string or a language value object as described in 10.1 Language and ' +
'Base Direction.', async function() {
await issue(require('./input/credential-issuer-name-ok.json'));
await issue(require(
'./input/credential-issuer-name-optional-ok.json'));
await issue(require(
'./input/credential-issuer-name-language-en-ok.json'));
await issue(require(
Expand All @@ -344,6 +346,21 @@ describe('Verifiable Credentials Data Model v2.0', function() {
await assert.rejects(issue(require(
'./input/credential-issuer-name-extra-prop-en-fail.json')));
});
it2('If present, the value of the "issuer.description" property ' +
'MUST be a string or a language value object as described in 10.1 ' +
'Language and Base Direction.', async function() {
await issue(require('./input/credential-issuer-description-ok.json'));
await issue(require(
'./input/credential-issuer-description-optional-ok.json'));
await issue(require(
'./input/credential-issuer-description-language-en-ok.json'));
JSAssassin marked this conversation as resolved.
Show resolved Hide resolved
await issue(require('./input/credential-issuer-description-language-' +
'direction-en-ok.json'));
await issue(require(
'./input/credential-issuer-multi-language-description-ok.json'));
await assert.rejects(issue(require(
'./input/credential-issuer-description-extra-prop-en-fail.json')));
});
it2('If present, the value of the validFrom property MUST be an ' +
'[XMLSCHEMA11-2] dateTimeStamp string value representing the date ' +
'and time the credential becomes valid, which could be a date and ' +
Expand Down
19 changes: 19 additions & 0 deletions tests/input/credential-issuer-description-extra-prop-en-fail.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"@context": [
"https://www.w3.org/ns/credentials/v2"
],
"type": [
"VerifiableCredential"
],
"issuer": {
"id": "did:example:issuer",
"description": {
"@value": "An Example Issuer",
"@language": "en",
"url": "did:example:issuer"
}
},
"credentialSubject": {
"id": "did:example:subject"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"@context": [
"https://www.w3.org/ns/credentials/v2"
],
"type": [
"VerifiableCredential"
],
"issuer": {
"id": "did:example:issuer",
"description": {
"@value": "An Example Issuer",
"@language": "en",
"@direction": "ltr"
}
},
"credentialSubject": {
"id": "did:example:subject"
}
}
18 changes: 18 additions & 0 deletions tests/input/credential-issuer-description-language-en-ok.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"@context": [
"https://www.w3.org/ns/credentials/v2"
],
"type": [
"VerifiableCredential"
],
"issuer": {
"id": "did:example:issuer",
"description": {
"@value": "An Example Issuer",
"@language": "en"
}
},
"credentialSubject": {
"id": "did:example:subject"
}
}
15 changes: 15 additions & 0 deletions tests/input/credential-issuer-description-ok.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": [
"https://www.w3.org/ns/credentials/v2"
],
"type": [
"VerifiableCredential"
],
"issuer": {
"id": "did:example:issuer",
"description": "An Example Issuer"
},
"credentialSubject": {
"id": "did:example:subject"
}
}
14 changes: 14 additions & 0 deletions tests/input/credential-issuer-description-optional-ok.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"@context": [
"https://www.w3.org/ns/credentials/v2"
],
"type": [
"VerifiableCredential"
],
"issuer": {
"id": "did:example:issuer"
},
"credentialSubject": {
"id": "did:example:subject"
}
}
24 changes: 24 additions & 0 deletions tests/input/credential-issuer-multi-language-description-ok.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"@context": [
"https://www.w3.org/ns/credentials/v2"
],
"type": [
"VerifiableCredential"
],
"issuer": {
"id": "did:issuer:dog",
"description": [{
"@value":"Dog",
"@language": "en"
}, {
"@value":"Chien",
"@language": "fr"
}, {
"@value":"Cane",
"@language": "it"
}]
},
"credentialSubject": {
"id": "did:example:subject"
}
}
14 changes: 14 additions & 0 deletions tests/input/credential-issuer-name-optional-ok.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"@context": [
"https://www.w3.org/ns/credentials/v2"
],
"type": [
"VerifiableCredential"
],
"issuer": {
"id": "did:example:issuer"
},
"credentialSubject": {
"id": "did:example:subject"
}
}