Skip to content

Commit

Permalink
Minor corrections to jcs suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Nov 13, 2024
1 parent 8cdd7d4 commit 1771eba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
16 changes: 4 additions & 12 deletions tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,14 @@ export function getColumnNameForTestCategory(testCategory) {
}
}

export function setupReportableTestSuite(runnerContext, name) {
export function setupReportableTestSuite(
runnerContext,
name = 'Implementation'
) {
runnerContext.matrix = true;
runnerContext.report = true;
runnerContext.rowLabel = 'Test Name';
runnerContext.columnLabel = name;

runnerContext.implemented = [];
}

Expand All @@ -233,16 +235,6 @@ export function isValidDatetime(dateString) {
return !isNaN(Date.parse(dateString));
}

export function setupMatrix(match) {
// this will tell the report
// to make an interop matrix with this suite
this.matrix = true;
this.report = true;
this.implemented = [...match.keys()];
this.rowLabel = 'Test Name';
this.columnLabel = 'Implementer';
}

export const config = JSON.parse(readFileSync('./config/runner.json'));

export function createValidCredential(version = 2) {
Expand Down
24 changes: 12 additions & 12 deletions tests/suites/algorithms-jcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getProofs,
isValidDatetime,
isValidUtf8,
setupMatrix,
setupReportableTestSuite,
setupRow
} from '../helpers.js';
import chai from 'chai';
Expand All @@ -20,7 +20,7 @@ export function ecdsaJcs2019Algorithms() {
const {tags} = config.suites[
cryptosuite
];
const {issuerMatch} = endpoints.filterByTag({
const {match: issuers} = endpoints.filterByTag({
tags: [...tags],
property: 'issuers'
});
Expand All @@ -31,12 +31,12 @@ export function ecdsaJcs2019Algorithms() {
const should = chai.should();

describe('ecdsa-jcs-2019 - Algorithms - Transformation', function() {
setupMatrix.call(this, issuerMatch);
setupReportableTestSuite(this);
let validCredential;
before(async function() {
validCredential = await createValidCredential();
});
for(const [columnId, {endpoints}] of issuerMatch) {
for(const [columnId, {endpoints}] of issuers) {
describe(columnId, function() {
const [issuer] = endpoints;
let issuedVc;
Expand Down Expand Up @@ -99,21 +99,21 @@ export function ecdsaJcs2019Algorithms() {
'Expected a cryptosuite identifier on the proof.');
proof.type.should.equal('DataIntegrityProof',
'Expected DataIntegrityProof type.');
proof.cryptosuite.should.equal('ecdsa-jcs-2022',
'Expected ecdsa-jcs-2022 cryptosuite.');
proof.cryptosuite.should.equal('ecdsa-jcs-2019',
'Expected ecdsa-jcs-2019 cryptosuite.');
}
});
});
}
});

describe('ecdsa-jcs-2019 - Algorithms - Proof Configuration', function() {
setupMatrix.call(this, issuerMatch);
setupReportableTestSuite(this);
let validCredential;
before(async function() {
validCredential = await createValidCredential();
});
for(const [columnId, {endpoints}] of issuerMatch) {
for(const [columnId, {endpoints}] of issuers) {
describe(columnId, function() {
const [issuer] = endpoints;
let issuedVc;
Expand Down Expand Up @@ -162,8 +162,8 @@ export function ecdsaJcs2019Algorithms() {
'Expected a cryptosuite identifier on the proof.');
proof.type.should.equal('DataIntegrityProof',
'Expected DataIntegrityProof type.');
proof.cryptosuite.should.equal('ecdsa-jcs-2022',
'Expected ecdsa-jcs-2022 cryptosuite.');
proof.cryptosuite.should.equal('ecdsa-jcs-2019',
'Expected ecdsa-jcs-2019 cryptosuite.');
}
});
it('If proofConfig.created is set and if the value is not a ' +
Expand All @@ -185,12 +185,12 @@ export function ecdsaJcs2019Algorithms() {
});

describe('ecdsa-jcs-2019 - Algorithms - Transformation', function() {
setupMatrix.call(this, issuerMatch);
setupReportableTestSuite(this);
let validCredential;
before(async function() {
validCredential = await createValidCredential();
});
for(const [columnId, {endpoints}] of issuerMatch) {
for(const [columnId, {endpoints}] of issuers) {
describe(columnId, function() {
const [issuer] = endpoints;
let issuedVc;
Expand Down

0 comments on commit 1771eba

Please sign in to comment.