Skip to content

Commit

Permalink
Move lone transformation test to main area.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Nov 13, 2024
1 parent 565007b commit f044d3c
Showing 1 changed file with 13 additions and 45 deletions.
58 changes: 13 additions & 45 deletions tests/suites/algorithms-jcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
import chai from 'chai';
import {endpoints} from 'vc-test-suite-implementations';

const should = chai.should();

export function ecdsaJcs2019Algorithms() {
const cryptosuite = 'ecdsa-jcs-2019';
const {tags} = config.suites[
Expand All @@ -24,7 +26,6 @@ export function ecdsaJcs2019Algorithms() {
tags: [...tags],
property: 'issuers'
});
const should = chai.should();

describe('ecdsa-jcs-2019 - Algorithms - Transformation', function() {
setupReportableTestSuite(this);
Expand Down Expand Up @@ -55,6 +56,17 @@ export function ecdsaJcs2019Algorithms() {
jcs2019Proofs.length.should.be.gte(1, 'Expected at least one ' +
'ecdsa-jcs-2019 cryptosuite.');
};
it('The proof options MUST contain a type identifier for the ' +
'cryptographic suite (type) and MAY contain a cryptosuite ' +
'identifier (cryptosuite).',
async function() {
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-serialization-ecdsa-jcs-2019';
assertBefore();
for(const proof of jcs2019Proofs) {
should.exist(proof.type,
'Expected a type identifier on the proof.');
}
});
it('The transformation options MUST contain a type identifier ' +
'for the cryptographic suite (type) and a cryptosuite identifier ' +
'(cryptosuite).',
Expand Down Expand Up @@ -181,48 +193,4 @@ export function ecdsaJcs2019Algorithms() {
});
}
});

describe('ecdsa-jcs-2019 - Algorithms - Transformation', function() {
setupReportableTestSuite(this);
this.implemented = [...issuers.keys()];
let validCredential;
before(async function() {
validCredential = await createValidCredential();
});
for(const [columnId, {endpoints}] of issuers) {
describe(columnId, function() {
const [issuer] = endpoints;
let issuedVc;
let proofs;
let jcs2019Proofs = [];
before(async function() {
issuedVc = await createInitialVc({issuer, vc: validCredential});
proofs = getProofs(issuedVc);
if(proofs?.length) {
jcs2019Proofs = proofs.filter(
proof => proof?.cryptosuite === cryptosuite);
}
});
beforeEach(setupRow);
const assertBefore = () => {
should.exist(issuedVc, 'Expected issuer to have issued a ' +
'credential.');
should.exist(proofs, 'Expected credential to have a proof.');
jcs2019Proofs.length.should.be.gte(1, 'Expected at least one ' +
'ecdsa-jcs-2019 cryptosuite.');
};
it('The proof options MUST contain a type identifier for the ' +
'cryptographic suite (type) and MAY contain a cryptosuite ' +
'identifier (cryptosuite).',
async function() {
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-serialization-ecdsa-jcs-2019';
assertBefore();
for(const proof of jcs2019Proofs) {
should.exist(proof.type,
'Expected a type identifier on the proof.');
}
});
});
}
});
}

0 comments on commit f044d3c

Please sign in to comment.