Skip to content

Commit

Permalink
Add test fixtures for previousProof Array & string missing.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Aug 30, 2024
1 parent 53c4046 commit 1f21783
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions suites/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,43 @@ export function runDataIntegrityProofVerifyTests({
await verificationSuccess({
credential: credentials.clone('previousProofString'),
verifier,
reason: 'Should verify VC with a string "proof.previousProof"'
reason: 'Should verify VC with a string "proof.previousProof".'
});
await verificationSuccess({
credential: credentials.clone('previousProofArray'),
verifier,
reason: 'Should verify VC with an Array "proof.previousProof"'
reason: 'Should verify VC with an Array "proof.previousProof".'
});
});
it('If an unordered list (proof.previousProof), all referenced proofs in ' +
it('If an unordered list (proof), all referenced proofs in ' +
'the array MUST verify.', async function() {
this.test.link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20an%20unordered%20list%2C%20all%20referenced%20proofs%20in%20the%20array%20MUST%20verify';

await verificationSuccess({
credential: credentials.clone('proofSet'),
verifier,
reason: 'Should verify VC with multiple proofs.'
});
});
it('If a proof with id equal to previousProof does not exist in ' +
'allProofs, an error MUST be raised and SHOULD convey an error type ' +
'of PROOF_GENERATION_ERROR.', async function() {
this.test.link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20a%20proof%20with%20id%20equal%20to%20previousProof%20does%20not%20exist%20in%20allProofs%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.';
await verificationFail({
credential: credentials.clone('missingPreviousProofString'),
verifier,
reason: 'Should not verify VC with invalid "proof.previousProof".'
});
});
it('If any element of previousProof list has an id attribute that does ' +
'not match the id attribute of any element of allProofs, an error MUST ' +
'be raised and SHOULD convey an error type of PROOF_GENERATION_ERROR.',
async function() {
this.test.link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20any%20element%20of%20previousProof%20list%20has%20an%20id%20attribute%20that%20does%20not%20match%20the%20id%20attribute%20of%20any%20element%20of%20allProofs%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.';
await verificationFail({
credential: credentials.clone('missingPreviousProofArray'),
verifier,
reason: 'Should not verify VC with invalid "proof.previousProof".'
});
});
it('When deserializing to RDF, implementations MUST ensure that the ' +
'base URL is set to null.', async function() {
Expand Down

0 comments on commit 1f21783

Please sign in to comment.