Skip to content

Commit

Permalink
rework test
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Hellawell <[email protected]>
  • Loading branch information
cykoder authored and lovesh committed Sep 26, 2023
1 parent 9637666 commit b8b5dfb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions tests/integration/anoncreds/issuing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ for (const {
lprNumber: 1234,
},
};

describe(`${Name} Module`, () => {
const dock = new DockAPI();
const resolver = new DockResolver(dock);
Expand Down
33 changes: 22 additions & 11 deletions tests/unit/static-bbs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,36 @@ import { verifyCredential } from '../../src/utils/vc/index';
import defaultDocumentLoader from '../../src/utils/vc/document-loader';
import didDocument from '../data/static-did-dock.json';
import staticCred610 from '../data/static-bbs-cred-610.json';
// import staticCred630 from '../data/static-bbs-cred-630.json'; // TODO: add a credential from 6.3.0

const loadDocumentDefault = defaultDocumentLoader(null);

async function documentLoader(doc) {
if (doc.startsWith(staticCred610.issuer.id)) {
return {
contextUrl: null,
documentUrl: doc,
document: didDocument,
};
}

return loadDocumentDefault(doc);
}

describe('Static BBS+ Credential Verification (backwards compatibility)', () => {
test('verifies BBS+ credential from SDK 6.1.0', async () => {
const result = await verifyCredential(staticCred610, {
documentLoader: async (doc) => {
if (doc.startsWith(staticCred610.issuer.id)) {
return {
contextUrl: null,
documentUrl: doc,
document: didDocument,
};
}

return loadDocumentDefault(doc);
},
documentLoader,
});
console.error(JSON.stringify(result, null, 2));
expect(result.verified).toBe(true);
});

// test('verifies BBS+ credential from SDK 6.3.0', async () => {
// const result = await verifyCredential(staticCred630, {
// documentLoader,
// });
// console.error(JSON.stringify(result, null, 2));
// expect(result.verified).toBe(true);
// });
});

0 comments on commit b8b5dfb

Please sign in to comment.