Skip to content

Commit 42d791f

Browse files
committed
Fill in first VM test & get proofs.
1 parent b6bc293 commit 42d791f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/suites/data-model.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function dataModelSuite({
1616
credential,
1717
mandatoryPointers
1818
}) {
19-
describe(`${suiteName} - Data Model - VC ${vcVersion}`, function() {
19+
return describe(`${suiteName} - Data Model - VC ${vcVersion}`, function() {
2020
this.matrix = true;
2121
this.report = true;
2222
this.implemented = [...issuers];
@@ -30,13 +30,20 @@ export function dataModelSuite({
3030
}
3131
describe(`${name}: ${keyType}`, function() {
3232
let securedCredential = null;
33+
let proofs = [];
3334
before(async function() {
3435
securedCredential = await createInitialVc({
3536
issuer,
3637
vcVersion,
3738
vc: credential,
3839
mandatoryPointers
3940
});
41+
if(securedCredential) {
42+
proofs = Array.isArray(securedCredential.proofs) ?
43+
securedCredential?.proofs : [securedCredential?.proofs];
44+
// only test proofs that match the relevant cryptosuite
45+
proofs.filter(p => p.cryptosuite === suiteName);
46+
}
4047
});
4148
beforeEach(function() {
4249
this.currentTest.cell = {
@@ -49,6 +56,10 @@ export function dataModelSuite({
4956
securedCredential,
5057
`Expected issuer ${name}: ${keyType} to issue a VC`
5158
).to.exist;
59+
expect(
60+
securedCredential,
61+
'Expected VC to be an object'
62+
).to.be.an('object');
5263
}
5364
it('The publicKeyMultibase value of the verification method MUST ' +
5465
'start with the base-58-btc prefix (z), as defined in the ' +
@@ -58,6 +69,14 @@ export function dataModelSuite({
5869
async function() {
5970
this.test.link = 'https://w3c.github.io/vc-di-eddsa/#data-model:~:text=in%20this%20specification.-,The%20publicKeyMultibase%20value%20of%20the%20verification%20method%20MUST%20start%20with%20the%20base%2D58%2Dbtc%20prefix,-(z)%2C%20as';
6071
assertBefore();
72+
for(const proof of proofs) {
73+
expect(proof.verificationMethod).to.exist;
74+
expect(proof.verificationMethod).to.be.a('string');
75+
expect(
76+
assertions.shouldBeBs58(proof.verificationMethod),
77+
'Expected "proof.verificationMethod" to be Base58 encoded'
78+
).to.be.true;
79+
}
6180
});
6281
it('Any other encoding MUST NOT be allowed. (verificationMethod)',
6382
async function() {

0 commit comments

Comments
 (0)