From cc0567891fcde8ac5ac9175a7e1d7b9a9718b4eb Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 6 Dec 2023 19:42:15 +0000 Subject: [PATCH] Add credentialStatus to VCs in status tests & fix assertion in negative test. --- test/10-verify.spec.js | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/test/10-verify.spec.js b/test/10-verify.spec.js index b464b349..c4817b5b 100644 --- a/test/10-verify.spec.js +++ b/test/10-verify.spec.js @@ -304,8 +304,23 @@ describe('verify API (credentials)', () => { }); it('should verify a vc with a positive status check', async () => { + const credential = jsonld.clone(mockCredential); + credential['@context'].push({ + '@context': { + id: '@id', + type: '@type', + TestStatusList: { + '@id': 'https://example.edu/TestStatusList', + '@type': '@id' + } + } + }); + credential.credentialStatus = { + id: 'https://example.edu/status/24', + type: 'TestStatusList' + }; const verifiableCredential = await vc.issue({ - credential: mockCredential, + credential, suite, documentLoader }); @@ -402,8 +417,23 @@ describe('verify API (credentials)', () => { results.verified.should.be.false; }); it('should fail to verify a vc with a negative status check', async () => { + const credential = jsonld.clone(mockCredential); + credential['@context'].push({ + '@context': { + id: '@id', + type: '@type', + TestStatusList: { + '@id': 'https://example.edu/TestStatusList', + '@type': '@id' + } + } + }); + credential.credentialStatus = { + id: 'https://example.edu/status/24', + type: 'TestStatusList' + }; const verifiableCredential = await vc.issue({ - credential: mockCredential, + credential, suite, documentLoader }); @@ -418,7 +448,7 @@ describe('verify API (credentials)', () => { if(result.error) { throw result.error; } - result.verified.should.be.true; + result.verified.should.be.false; }); it('should verify a changed derived vc', async () => { const proofId = `urn:uuid:${uuid()}`;