Skip to content

Commit

Permalink
Refactor to use better structure for test data.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Jun 10, 2024
1 parent 9aaec8d commit c2f04b6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
20 changes: 18 additions & 2 deletions test/10-issue.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ for(const [version, mockCredential] of versionedCredentials) {
);
});
it('should issue a VC with multiple languages', async function() {
const credential = structuredClone(credentials.language.multiple);
const credential = structuredClone(
credentials.features.multiple.languages);
const verifiableCredential = await vc.issue({
credential,
suite,
Expand All @@ -348,7 +349,8 @@ for(const [version, mockCredential] of versionedCredentials) {
verifiableCredential.proof.should.be.an('object');
});
it('should issue a VC with a single language', async function() {
const credential = structuredClone(credentials.language.single);
const credential = structuredClone(
credentials.features.single.language);
const verifiableCredential = await vc.issue({
credential,
suite,
Expand All @@ -359,6 +361,20 @@ for(const [version, mockCredential] of versionedCredentials) {
verifiableCredential.should.have.property('proof');
verifiableCredential.proof.should.be.an('object');
});
it('should issue a VC with a single language & direction',
async function() {
const credential = structuredClone(
credentials.features.single.direction);
const verifiableCredential = await vc.issue({
credential,
suite,
documentLoader
});
verifiableCredential.should.exist;
verifiableCredential.should.be.an('object');
verifiableCredential.should.have.property('proof');
verifiableCredential.proof.should.be.an('object');
});
}
});
describe('vc.signPresentation()', () => {
Expand Down
12 changes: 9 additions & 3 deletions test/mocks/mock.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ const _mixedCredential = () => {

export const credentials = mock.credentials = {};
credentials.mixed = _mixedCredential();
credentials.language = {
multiple: require('./credential-issuer-multi-language-description-ok.json'),
single: require('./credential-issuer-name-language-en-ok.json')
credentials.features = {
multiple: {
languages: require('./credential-issuer-multi-language-description-ok.json'),
directions: null
},
single: {
language: require('./credential-issuer-name-language-en-ok.json'),
direction: require('./credential-issuer-name-language-direction-en-ok.json')
}
};
credentials.alpha = {
"@context": [
Expand Down

0 comments on commit c2f04b6

Please sign in to comment.