Skip to content

Commit

Permalink
Move tests into assertions and call from an overall test file.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Jul 10, 2024
1 parent 5f4b010 commit 43268d7
Show file tree
Hide file tree
Showing 19 changed files with 1,946 additions and 2,133 deletions.
2 changes: 1 addition & 1 deletion test/mocha/10-provision.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {mockData} from './mock.data.js';
const {baseUrl} = mockData;
const serviceType = 'vc-issuer';

describe('provision API', () => {
describe('provision', () => {
let capabilityAgent;
let keystoreAgent;
let zcaps = {};
Expand Down
130 changes: 0 additions & 130 deletions test/mocha/20-issue-no-status.js

This file was deleted.

124 changes: 124 additions & 0 deletions test/mocha/20-issue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*!
* Copyright (c) 2020-2024 Digital Bazaar, Inc. All rights reserved.
*/
import {testBitstringStatusList} from './assertions/testBitstringStatusList.js';
import {testIssueCrashRecovery} from './assertions/testIssueCrashRecovery.js';
import {testIssueSd} from './assertions/testIssueSd.js';
import {testIssueWithOAuth2} from './assertions/issueWithOAuth2.js';
import {testIssueWithoutStatus} from './assertions/issueWithoutStatus.js';
import {testIssueXi} from './assertions/testIssueXi.js';
import {testStatusScaling} from './assertions/testStatusScaling.js';
import {
testTerseBitstringStatusList
} from './assertions/testTerseBitstringStatusList.js';

describe('issue', () => {
describe('eddsa-rdfc-2022', () => {
const options = {
suiteName: 'eddsa-rdfc-2022',
algorithm: 'Ed25519',
issueOptions: {},
statusOptions: {}
};
testIssueWithoutStatus(options);
testBitstringStatusList(options);
testTerseBitstringStatusList(options);

// to reduce runtime and because a different suite should not change
// the results, only this suite runs against these tests
testIssueWithOAuth2(options);
testIssueCrashRecovery(options);
testStatusScaling(options);
});

describe('ecdsa-rdfc-2019, P-256', () => {
const options = {
suiteName: 'ecdsa-rdfc-2019',
algorithm: 'P-256',
issueOptions: {},
statusOptions: {}
};
testIssueWithoutStatus(options);
testBitstringStatusList(options);
testTerseBitstringStatusList(options);
});

describe('ecdsa-rdfc-2019, P-384', () => {
const options = {
suiteName: 'ecdsa-rdfc-2019',
algorithm: 'P-384',
issueOptions: {},
statusOptions: {}
};
testIssueWithoutStatus(options);
testBitstringStatusList(options);
testTerseBitstringStatusList(options);
});

describe('ecdsa-sd-2023', () => {
const options = {
suiteName: 'ecdsa-sd-2023',
algorithm: 'P-256',
issueOptions: {},
statusOptions: {
// sign status list with simple ECDSA
suiteName: 'ecdsa-rdfc-2019',
algorithm: 'P-256'
},
terseIssueOptions: {mandatoryPointers: ['/issuer']}
};
testIssueWithoutStatus(options);
testBitstringStatusList(options);
testTerseBitstringStatusList(options);
});

describe('bbs-2023', () => {
const options = {
suiteName: 'bbs-2023',
algorithm: 'Bls12381G2',
issueOptions: {},
statusOptions: {
// sign status list with simple ECDSA
suiteName: 'ecdsa-rdfc-2019',
algorithm: 'P-256'
},
terseIssueOptions: {mandatoryPointers: ['/issuer']}
};
testIssueWithoutStatus(options);
testIssueSd(options);
testBitstringStatusList(options);
testTerseBitstringStatusList(options);
});

describe('ecdsa-xi-2023, P-256', () => {
const options = {
suiteName: 'ecdsa-xi-2023',
algorithm: 'P-256',
issueOptions: {
extraInformation: 'abc'
},
statusOptions: {
// sign status list with simple ECDSA
suiteName: 'ecdsa-rdfc-2019',
algorithm: 'P-256'
}
};

testIssueWithoutStatus(options);
testIssueXi(options);
testBitstringStatusList(options);
testTerseBitstringStatusList(options);
});

describe('Ed25519Signature2020', () => {
const options = {
suiteName: 'Ed25519Signature2020',
algorithm: 'Ed25519',
issueOptions: {},
statusOptions: {}
};
testIssueWithoutStatus(options);
testBitstringStatusList(options);
testTerseBitstringStatusList(options);
});
});
Loading

0 comments on commit 43268d7

Please sign in to comment.