Skip to content

Commit 77a28d0

Browse files
committed
Replace endpoints.createVp with static test vectors.
1 parent 9d4e2be commit 77a28d0

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

tests/413.2-envelopes.js

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,6 @@ describe('VP - Enveloped Verifiable Presentations', function() {
8888
const endpoints = new TestEndpoints({implementation, tag});
8989

9090
describe(name, function() {
91-
let createdVp;
92-
before(async function() {
93-
try {
94-
createdVp = await endpoints.createVp({
95-
presentation: require('./input/presentation-vc-ok.json')
96-
});
97-
} catch(e) {
98-
console.error(
99-
`Holder: ${name} failed to create "presentation-vc-ok.json".`,
100-
e
101-
);
102-
}
103-
});
10491
beforeEach(addPerTestMetadata);
10592

10693
it('The @context property of the object MUST be present and include a ' +
@@ -109,32 +96,33 @@ describe('VP - Enveloped Verifiable Presentations', function() {
10996
'terms as defined by the base context provided by this specification.',
11097
async function() {
11198
this.test.link = `https://w3c.github.io/vc-data-model/#enveloped-verifiable-presentations:~:text=The%20%40context%20property%20of%20the%20object%20MUST%20be%20present%20and%20include%20a%20context%2C%20such%20as%20the%20base%20context%20for%20this%20specification%2C%20that%20defines%20at%20least%20the%20id%2C%20type%2C%20and%20EnvelopedVerifiablePresentation%20terms%20as%20defined%20by%20the%20base%20context%20provided%20by%20this%20specification.`;
112-
// TODO: implement test, dynamic presentation from issued
113-
this.test.cell.skipMessage = 'Missing Enveloped VP';
114-
this.skip();
99+
await assert.rejects(
100+
endpoints.verifyVp(require(
101+
'./input/enveloped-presentation-context-fail.json')),
102+
{name: 'HTTPError'},
103+
'Failed to reject Enveloped VP missing contexts.');
115104
});
116105

117106
it('The id value of the object MUST be a data: URL [RFC2397] that ' +
118107
'expresses a secured verifiable presentation using an enveloping ' +
119108
'securing mechanism, such as Securing Verifiable Credentials using ' +
120109
'JOSE and COSE [VC-JOSE-COSE].', async function() {
121110
this.test.link = `https://w3c.github.io/vc-data-model/#enveloped-verifiable-presentations:~:text=The%20id%20value%20of%20the%20object%20MUST%20be%20a%20data%3A%20URL%20%5BRFC2397%5D%20that%20expresses%20a%20secured%20verifiable%20presentation%20using%20an%20enveloping%20securing%20mechanism%2C%20such%20as%20Securing%20Verifiable%20Credentials%20using%20JOSE%20and%20COSE%20%5BVC%2DJOSE%2DCOSE%5D.`;
122-
this.test.cell.skipMessage = 'Missing Enveloped VP';
123-
this.skip();
124-
createdVp.should.have.property('id').that.does
125-
.include('data:',
126-
`Expecting id field to be a 'data:' scheme URL [RFC2397].`);
127-
// TODO extract and test Presentation
111+
await assert.rejects(
112+
endpoints.verifyVp(require(
113+
'./input/enveloped-presentation-id-fail.json')),
114+
{name: 'HTTPError'},
115+
'Failed to reject Enveloped VP with an id that is not a data url.');
128116
});
129117

130118
it('The type value of the object MUST be ' +
131119
'EnvelopedVerifiablePresentation.', async function() {
132120
this.test.link = `https://w3c.github.io/vc-data-model/#enveloped-verifiable-presentations:~:text=The%20type%20value%20of%20the%20object%20MUST%20be%20EnvelopedVerifiablePresentation.`;
133-
this.test.cell.skipMessage = 'Missing Enveloped VP';
134-
this.skip();
135-
createdVp.should.have.property('type').that.does
136-
.include('EnvelopedVerifiablePresentation',
137-
`Expecting type field to be EnvelopedVerifiablePresentation`);
121+
await assert.rejects(
122+
endpoints.verifyVp(require(
123+
'./input/enveloped-presentation-type-fail.json')),
124+
{name: 'HTTPError'},
125+
'Failed to reject VP w/o type "EnvelopedVerifiablePresentation".');
138126
});
139127
});
140128
}

0 commit comments

Comments
 (0)