From b8b5dfb41b6676b2595e10e999cade02f770243b Mon Sep 17 00:00:00 2001 From: Sam Hellawell Date: Tue, 26 Sep 2023 20:09:34 +0100 Subject: [PATCH] rework test Signed-off-by: Sam Hellawell --- tests/integration/anoncreds/issuing.test.js | 1 + tests/unit/static-bbs.test.js | 33 ++++++++++++++------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/tests/integration/anoncreds/issuing.test.js b/tests/integration/anoncreds/issuing.test.js index ccd00fa04..afd0c8f22 100644 --- a/tests/integration/anoncreds/issuing.test.js +++ b/tests/integration/anoncreds/issuing.test.js @@ -85,6 +85,7 @@ for (const { lprNumber: 1234, }, }; + describe(`${Name} Module`, () => { const dock = new DockAPI(); const resolver = new DockResolver(dock); diff --git a/tests/unit/static-bbs.test.js b/tests/unit/static-bbs.test.js index 8feb1abee..e4fb8b30c 100644 --- a/tests/unit/static-bbs.test.js +++ b/tests/unit/static-bbs.test.js @@ -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); + // }); });