diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a78ac7..fd74da4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. ## 1.0.0 - 2023-11-10 diff --git a/tests/10-vcdm2.js b/tests/10-vcdm2.js index cd825bd..3008e60 100644 --- a/tests/10-vcdm2.js +++ b/tests/10-vcdm2.js @@ -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( @@ -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')); + 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 ' + diff --git a/tests/input/credential-issuer-description-extra-prop-en-fail.json b/tests/input/credential-issuer-description-extra-prop-en-fail.json new file mode 100644 index 0000000..6d61c16 --- /dev/null +++ b/tests/input/credential-issuer-description-extra-prop-en-fail.json @@ -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" + } +} diff --git a/tests/input/credential-issuer-description-language-direction-en-ok.json b/tests/input/credential-issuer-description-language-direction-en-ok.json new file mode 100644 index 0000000..b3d0dbb --- /dev/null +++ b/tests/input/credential-issuer-description-language-direction-en-ok.json @@ -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" + } +} diff --git a/tests/input/credential-issuer-description-language-en-ok.json b/tests/input/credential-issuer-description-language-en-ok.json new file mode 100644 index 0000000..028a812 --- /dev/null +++ b/tests/input/credential-issuer-description-language-en-ok.json @@ -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" + } +} diff --git a/tests/input/credential-issuer-description-ok.json b/tests/input/credential-issuer-description-ok.json new file mode 100644 index 0000000..3596dfd --- /dev/null +++ b/tests/input/credential-issuer-description-ok.json @@ -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" + } +} diff --git a/tests/input/credential-issuer-description-optional-ok.json b/tests/input/credential-issuer-description-optional-ok.json new file mode 100644 index 0000000..62d8438 --- /dev/null +++ b/tests/input/credential-issuer-description-optional-ok.json @@ -0,0 +1,14 @@ +{ + "@context": [ + "https://www.w3.org/ns/credentials/v2" + ], + "type": [ + "VerifiableCredential" + ], + "issuer": { + "id": "did:example:issuer" + }, + "credentialSubject": { + "id": "did:example:subject" + } +} diff --git a/tests/input/credential-issuer-multi-language-description-ok.json b/tests/input/credential-issuer-multi-language-description-ok.json new file mode 100644 index 0000000..692ba1d --- /dev/null +++ b/tests/input/credential-issuer-multi-language-description-ok.json @@ -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" + } +} diff --git a/tests/input/credential-issuer-name-optional-ok.json b/tests/input/credential-issuer-name-optional-ok.json new file mode 100644 index 0000000..62d8438 --- /dev/null +++ b/tests/input/credential-issuer-name-optional-ok.json @@ -0,0 +1,14 @@ +{ + "@context": [ + "https://www.w3.org/ns/credentials/v2" + ], + "type": [ + "VerifiableCredential" + ], + "issuer": { + "id": "did:example:issuer" + }, + "credentialSubject": { + "id": "did:example:subject" + } +}