Skip to content

Commit d155c81

Browse files
committed
Add non-existent json pointer test.
1 parent fdff03a commit d155c81

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/suites/algorithms-sd.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
* Copyright 2024 Digital Bazaar, Inc.
33
* SPDX-License-Identifier: BSD-3-Clause
44
*/
5+
import {
6+
assertions,
7+
} from 'data-integrity-test-suite-assertion';
58

69
export function sd2023Algorithms({
710
credential,
811
verifiers,
12+
issuers,
913
mandatoryPointers,
1014
selectivePointers,
1115
keyTypes,
@@ -33,6 +37,7 @@ export function sd2023Algorithms({
3337
});
3438
for(const [name, {endpoints}] of verifiers) {
3539
const [verifier] = endpoints;
40+
const [issuer] = issuers.get(name)?.endpoints;
3641
for(const keyType of keyTypes) {
3742
this.implemented.push(`${name}: ${keyType}`);
3843
describe(`${name}: ${keyType}`, function() {
@@ -59,6 +64,15 @@ export function sd2023Algorithms({
5964
'PROOF_GENERATION_ERROR, indicating that the JSON pointer does ' +
6065
'not match the given document.', async function() {
6166
this.test.link = 'https://w3c.github.io/vc-di-ecdsa/#selective-disclosure-functions:~:text=Set%20value%20to%20parentValue.path.%20If%20value%20is%20now%20undefined%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR%2C%20indicating%20that%20the%20JSON%20pointer%20does%20not%20match%20the%20given%20document.';
67+
await assertions.shouldFailIssuance({
68+
credential: structuredClone(credential),
69+
issuer,
70+
reason: 'Should not issue VC with json pointer that does not ' +
71+
'match credential.',
72+
options: {
73+
mandatoryPointers: ['/non/existent/path']
74+
}
75+
});
6276
});
6377
it('CBOR-encode components per [RFC8949] where CBOR tagging MUST ' +
6478
'NOT be used on any of the components. Append the produced encoded ' +

0 commit comments

Comments
 (0)