Skip to content

Commit

Permalink
Add test to check if "proof.proofPurpose" field matches the verification
Browse files Browse the repository at this point in the history
relationship.
  • Loading branch information
JSAssassin committed Nov 2, 2023
1 parent b3ad55e commit 7eb4a02
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions tests/10-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,45 @@ describe('eddsa-2022 (create)', function() {
it('Dereferencing the "verificationMethod" MUST result in an ' +
'object containing a type property with "Multikey" value.',
function() {
this.test.cell = {columnId, rowId: this.test.title};
verificationMethodDocuments.should.not.eql([], 'Expected ' +
'at least one "verificationMethodDocument".');
'at least one "verificationMethodDocument".');
verificationMethodDocuments.some(
verificationMethodDocument =>
verificationMethodDocument?.type === 'Multikey'
).should.equal(true, 'Expected at least one proof to have "type" ' +
'property value "Multikey".');
});
it('Dereferencing the "verificationMethod" MUST result in an ' +
'object containing a type property with "Multikey" value.',
function() {
it('The "proof.proofPurpose" field MUST match the verification ' +
'relationship expressed by the verification method controller.',
async function() {
this.test.cell = {columnId, rowId: this.test.title};
verificationMethodDocuments.should.not.eql([], 'Expected ' +
'at least one "verificationMethodDocument".');
verificationMethodDocuments.some(
verificationMethodDocument =>
verificationMethodDocument?.type === 'Multikey'
).should.equal(true, 'Expected at least one proof to have "type" ' +
'property value "Multikey".');
'property value "Multikey".'
);
const controllerDocuments = [];
for(const verificationMethodDocument of verificationMethodDocuments) {
const controllerDocument = await documentLoader({
url: verificationMethodDocument.controller
});
controllerDocuments.push(controllerDocument);
}
proofs.some(
proof => controllerDocuments.some(controllerDocument =>
controllerDocument.hasOwnProperty(proof.proofPurpose))
).should.equal(true, 'Expected "proof.proofPurpose" field ' +
'to match the verification method controller.'
);
});
it('The "publicKeyMultibase" value of the verification method MUST ' +
'be 35 bytes in length and starts with the base-58-btc prefix (z).',
async function() {
this.test.cell = {columnId, rowId: this.test.title};
verificationMethodDocuments.should.not.eql([], 'Expected ' +
'at least one "verificationMethodDocument".');
for(const verificationMethodDocument of verificationMethodDocuments) {
Expand Down

0 comments on commit 7eb4a02

Please sign in to comment.