Skip to content

Commit 82c0d71

Browse files
committed
Remove strict name validation on assert.rejects statements
Signed-off-by: PatStLouis <[email protected]>
1 parent 202d028 commit 82c0d71

13 files changed

+52
-53
lines changed

tests/1-3-conformance.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ describe('Basic Conformance', function() {
8484
const doc = {
8585
type: ['NonconformingDocument']
8686
};
87-
await assert.rejects(endpoints.verify(doc), {name: 'HTTPError'},
87+
await assert.rejects(endpoints.verify(doc),
8888
'Failed to reject malformed VC.');
89-
await assert.rejects(endpoints.verifyVp(doc), {name: 'HTTPError'},
89+
await assert.rejects(endpoints.verifyVp(doc),
9090
'Failed to reject malformed VP.');
9191
});
9292
});

tests/4-3-contexts.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('Contexts', function() {
8787
presentation: require('./input/presentation-context-order-fail.json')
8888
});
8989
await assert.rejects(endpoints.verifyVp(vpInvalidContextOrder),
90-
{name: 'HTTPError'},
90+
9191
'Failed to reject a VP that has the wrong context order.');
9292
const vp = createLocalVp({
9393
presentation: require('./input/presentation-ok.json')
@@ -100,7 +100,7 @@ describe('Contexts', function() {
100100
'Failed to reject a VP with unordered @context.');
101101
await assert.rejects(endpoints.verifyVp(
102102
require('./input/presentation-missing-base-context-fail.json')),
103-
{name: 'HTTPError'},
103+
104104
'Failed to reject a VP that lacked the VC base context URL.');
105105
});
106106
it('Verifiable Credential `@context`: "Subsequent items in the ' +
@@ -116,11 +116,11 @@ describe('Contexts', function() {
116116
'Failed to support objects in the `@context` Array.');
117117
await assert.rejects(endpoints.issue(require(
118118
'./input/credential-context-combo3-fail.json')),
119-
{name: 'HTTPError'},
119+
120120
'Failed to reject a VC with an invalid `@context` URL.');
121121
await assert.rejects(endpoints.issue(require(
122122
'./input/credential-context-combo4-fail.json')),
123-
{name: 'HTTPError'},
123+
124124
'Failed to reject a VC with an unsupported `@context` value type ' +
125125
'(number).');
126126
});

tests/4-4-identifiers.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Identifiers', function() {
3737
await assert.rejects(
3838
endpoints.issue(require(
3939
'./input/credential-id-nonidentifier-fail.json')),
40-
{name: 'HTTPError'},
40+
4141
'Failed to reject a credential with a `null` identifier.');
4242

4343
await assert.doesNotReject(endpoints.issue(require(
@@ -48,16 +48,16 @@ describe('Identifiers', function() {
4848
'Failed to accept a VC with a valid credentialSubject identifier');
4949
await assert.rejects(endpoints.issue(require(
5050
'./input/credential-id-multi-fail.json')),
51-
{name: 'HTTPError'},
51+
5252
'Failed to reject a VC with multiple `id` values.');
5353
await assert.rejects(endpoints.issue(require(
5454
'./input/credential-id-subject-multi-fail.json')),
55-
{name: 'HTTPError'},
55+
5656
'Failed to reject a VC with multiple credentialSubject identifiers.');
5757

5858
await assert.rejects(
5959
endpoints.issue(require('./input/credential-id-not-url-fail.json')),
60-
{name: 'HTTPError'},
60+
6161
'Failed to reject a credential with an invalid identifier.');
6262
});
6363
});

tests/4-5-types.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ describe('Types', function() {
3434
this.test.link = `https://w3c.github.io/vc-data-model/#types:~:text=Verifiable%20credentials%20and%20verifiable%20presentations%20MUST%20contain%20a%20type%20property%20with%20an%20associated%20value.`;
3535
await assert.rejects(
3636
endpoints.issue(require('./input/credential-no-type-fail.json')),
37-
{name: 'HTTPError'},
37+
3838
'Failed to reject a VC without a type.');
3939
});
4040
it('Verifiable presentations MUST contain a type property with an ' +
4141
'associated value.', async function() {
4242
this.test.link = `https://w3c.github.io/vc-data-model/#types:~:text=Verifiable%20credentials%20and%20verifiable%20presentations%20MUST%20contain%20a%20type%20property%20with%20an%20associated%20value.`;
4343
await assert.rejects(endpoints.verifyVp(require(
4444
'./input/presentation-no-type-fail.json')),
45-
{name: 'HTTPError'},
45+
4646
'Failed to reject a VP without a type.');
4747
});
4848
it('The value of the type property MUST be one or more terms and/or ' +
@@ -61,12 +61,12 @@ describe('Types', function() {
6161
// type mapped not to URL: fail
6262
await assert.rejects(endpoints.issue(require(
6363
'./input/credential-type-mapped-nonurl-fail.json')),
64-
{name: 'HTTPError'},
64+
6565
'Failed to reject a VC with type mapped to an invalid URL.');
6666
// type not mapped: fail
6767
await assert.rejects(endpoints.issue(require(
6868
'./input/credential-type-unmapped-fail.json')),
69-
{name: 'HTTPError'},
69+
7070
'Failed to reject a VC with an unmapped (via `@context`) type.');
7171
});
7272
it('If more than one (type) value is provided, the order does not ' +
@@ -92,7 +92,7 @@ describe('Types', function() {
9292
'Failed to accept a VC with additional type.');
9393
await assert.rejects(endpoints.issue(require(
9494
'./input/credential-missing-required-type-fail.json')),
95-
{name: 'HTTPError'},
95+
9696
'Failed to reject a VC missing the `VerifiableCredential` type.');
9797
}
9898
);
@@ -109,7 +109,7 @@ describe('Types', function() {
109109
await assert.rejects(
110110
endpoints.verifyVp(require(
111111
'./input/presentation-missing-required-type-fail.json')),
112-
{name: 'HTTPError'},
112+
113113
'Failed to reject VP missing `VerifiableCredential` type.');
114114
}
115115
);
@@ -122,7 +122,7 @@ describe('Types', function() {
122122
'Failed to accept a VC with `credentialStatus` with a `type`.');
123123
await assert.rejects(endpoints.issue(require(
124124
'./input/credential-status-missing-type-fail.json')),
125-
{name: 'HTTPError'},
125+
126126
'Failed to reject a VC with `credentialStatus` without a `type`.');
127127
}
128128
);
@@ -135,7 +135,7 @@ describe('Types', function() {
135135
'Failed to accept a VC with `termsOfUse` with a `type`.');
136136
await assert.rejects(endpoints.issue(require(
137137
'./input/credential-termsofuse-missing-type-fail.json')),
138-
{name: 'HTTPError'},
138+
139139
'Failed to reject a VC with `termsOfUse` without a `type`.');
140140
}
141141
);
@@ -148,7 +148,7 @@ describe('Types', function() {
148148
'Failed to accept a VC with `evidence` with a `type`.');
149149
await assert.rejects(endpoints.issue(require(
150150
'./input/credential-evidence-missing-type-fail.json')),
151-
{name: 'HTTPError'},
151+
152152
'Failed to reject a VC with `evidence` without a `type`.');
153153
}
154154
);
@@ -160,7 +160,7 @@ describe('Types', function() {
160160
'Failed to accept a VC with `refreshService` with a `type`.');
161161
await assert.rejects(endpoints.issue(require(
162162
'./input/credential-refresh-no-type-fail.json')),
163-
{name: 'HTTPError'},
163+
164164
'Failed to reject a VC with `refreshService` without a `type`.');
165165
}
166166
);
@@ -172,7 +172,7 @@ describe('Types', function() {
172172
'Failed to accept a VC with `credentialSchema` with a `type`.');
173173
await assert.rejects(endpoints.issue(require(
174174
'./input/credential-schema-no-type-fail.json')),
175-
{name: 'HTTPError'},
175+
176176
'Failed to reject `credentialSchema` without a `type`.');
177177
}
178178
);

tests/4-6-names-and-descriptions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('Names and Descriptions', function() {
6363
'Failed to accept a VC with `name` in multiple languages.');
6464
await assert.rejects(endpoints.issue(require(
6565
`${fixturePath}/credential-name-extra-prop-en-fail.json`)),
66-
{name: 'HTTPError'},
66+
6767
'Failed to reject a VC with `name` containing extra properties.');
6868
});
6969
it('If present, the value of the description property MUST be a string ' +
@@ -89,7 +89,7 @@ describe('Names and Descriptions', function() {
8989
'Failed to accept a VC with `description` in multiple languages.');
9090
await assert.rejects(endpoints.issue(require(
9191
`${fixturePath}/credential-description-extra-prop-en-fail.json`)),
92-
{name: 'HTTPError'},
92+
9393
'Failed to reject a VC with `description` containing extra ' +
9494
'properties.');
9595
});
@@ -117,7 +117,7 @@ describe('Names and Descriptions', function() {
117117
'Failed to accept a VC with `issuer.name` in multiple languages.');
118118
await assert.rejects(endpoints.issue(require(
119119
`${fixturePath}/issuer-name-extra-prop-en-fail.json`)),
120-
{name: 'HTTPError'},
120+
121121
'Failed to reject a VC with `issuer.name` containing extra ' +
122122
'properties.');
123123
});
@@ -146,7 +146,7 @@ describe('Names and Descriptions', function() {
146146
'languages.');
147147
await assert.rejects(endpoints.issue(require(
148148
`${fixturePath}/issuer-description-extra-prop-en-fail.json`)),
149-
{name: 'HTTPError'},
149+
150150
'Failed to reject a VC with `issuer.description` containing extra ' +
151151
'properties.');
152152
});

tests/4-7-issuer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ describe('Issuer', function() {
4343
'./input/credential-issuer-object-ok.json')));
4444
await assert.rejects(endpoints.issue(require(
4545
'./input/credential-issuer-no-url-fail.json')),
46-
{name: 'HTTPError'},
46+
4747
'Failed to reject an issuer identifier that was not a URL.');
4848
await assert.rejects(endpoints.issue(require(
4949
'./input/credential-issuer-null-fail.json')),
50-
{name: 'HTTPError'},
50+
5151
'Failed to reject a null issuer identifier.');
5252
await assert.rejects(endpoints.issue(require(
5353
'./input/credential-issuer-object-id-null-fail.json')),
54-
{name: 'HTTPError'},
54+
5555
'Failed to reject an issuer object containing a null identifier.');
5656
await assert.rejects(endpoints.issue(require(
5757
'./input/credential-issuer-object-id-no-url-fail.json')),
58-
{name: 'HTTPError'},
58+
5959
'Failed to reject an issuer object containing a non-URL identifier.');
6060
});
6161
});

tests/4-8-credential-subject.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Credential Subject', function() {
3333
this.test.link = `https://w3c.github.io/vc-data-model/#credential-subject:~:text=A%20verifiable%20credential%20MUST%20contain%20a%20credentialSubject%20property.`;
3434
await assert.rejects(endpoints.issue(require(
3535
'./input/credential-no-subject-fail.json')),
36-
{name: 'HTTPError'},
36+
3737
'Failed to rejet a VC without a `credentialSubject`.');
3838
}
3939
);
@@ -44,15 +44,15 @@ describe('Credential Subject', function() {
4444
this.test.link = `https://w3c.github.io/vc-data-model/#credential-subject:~:text=The%20value%20of%20the%20credentialSubject%20property%20is%20a%20set%20of%20objects%20where%20each%20object%20MUST%20be%20the%20subject%20of%20one%20or%20more%20claims%2C%20which%20MUST%20be%20serialized%20inside%20the%20credentialSubject%20property.`;
4545
await assert.rejects(endpoints.issue(require(
4646
'./input/credential-subject-no-claims-fail.json')),
47-
{name: 'HTTPError'},
47+
4848
'Failed to reject a VC with an empty `credentialSubject`.');
4949
await assert.doesNotReject(endpoints.issue(require(
5050
'./input/credential-subject-multiple-ok.json')),
5151
'Failed to accept a VC with multiple `credentialSubject`s.');
5252
await assert.rejects(
5353
endpoints.issue(require(
5454
'./input/credential-subject-multiple-empty-fail.json')),
55-
{name: 'HTTPError'},
55+
5656
'Failed to reject VC containing an empty `credentialSubject`.');
5757
});
5858
});

tests/4-9-validity-period.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('Validity Period', function() {
4242
'Failed to accept a VC using the subtractive timezone format.');
4343
await assert.rejects(endpoints.issue(require(
4444
'./input/credential-validfrom-invalid-fail.json')),
45-
{name: 'HTTPError'},
45+
4646
'Failed to reject a VC using an incorrect `validFrom` date-time ' +
4747
'format.');
4848
await assert.doesNotReject(endpoints.issue(require(
@@ -65,7 +65,7 @@ describe('Validity Period', function() {
6565
'Failed to accept a VC using the subtractive timezone format.');
6666
await assert.rejects(endpoints.issue(require(
6767
'./input/credential-validuntil-invalid-fail.json')),
68-
{name: 'HTTPError'},
68+
6969
'Failed to reject a VC using an inccorect `validUntil` date-time ' +
7070
'format.');
7171
});

tests/410-status.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ describe('Status', function() {
3737
'Failed to accept a VC with `credentialStatus` without an `id`.');
3838
await assert.rejects(endpoints.issue(require(
3939
'./input/credential-status-multiple-id-fail.json')),
40-
{name: 'HTTPError'},
40+
4141
'Failed to reject a VC with multiple `credentialStatus.id` values.');
4242
await assert.rejects(endpoints.issue(require(
4343
'./input/credential-status-nonurl-id-fail.json')),
44-
{name: 'HTTPError'},
44+
4545
'Failed to reject a VC with a non-URL `credentialStatus.id`.');
4646
});
4747
it('(If a credentialStatus property is present), The type ' +
@@ -51,11 +51,11 @@ describe('Status', function() {
5151
this.test.link = `https://w3c.github.io/vc-data-model/#status:~:text=The%20type%20property%20is%20REQUIRED.%20It%20is%20used%20to%20express%20the%20type%20of%20status%20information%20expressed%20by%20the%20object.%20The%20related%20normative%20guidance%20in%20Section%204.5%20Types%20MUST%20be%20followed.`;
5252
await assert.rejects(endpoints.issue(require(
5353
'./input/credential-status-missing-type-fail.json')),
54-
{name: 'HTTPError'},
54+
5555
'Failed to reject a VC missing `credentialStatus.type`.');
5656
await assert.rejects(endpoints.issue(require(
5757
'./input/credential-status-type-nonurl-fail.json')),
58-
{name: 'HTTPError'},
58+
5959
'Failed to reject a VC with a non-URL `credentialStatus.type`.');
6060
await assert.doesNotReject(endpoints.issue(require(
6161
'./input/credential-status-ok.json')),

tests/411-data-schemas.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ describe('Data Schemas', function() {
4747
this.test.link = `https://w3c.github.io/vc-data-model/#data-schemas:~:text=Each%20credentialSchema%20MUST%20specify%20its%20type%20(for%20example%2C%20JsonSchema)%2C%20and%20an%20id%20property%20that%20MUST%20be%20a%20URL%20identifying%20the%20schema%20file.`;
4848
await assert.rejects(endpoints.issue(require(
4949
'./input/credential-schema-no-type-fail.json')),
50-
{name: 'HTTPError'},
50+
5151
'Failed to reject `credentialSchema` without a `type`.');
5252
await assert.rejects(endpoints.issue(require(
5353
'./input/credential-schema-no-id-fail.json')),
54-
{name: 'HTTPError'},
54+
5555
'Failed to reject `credentialSchema` without an `id`.');
5656
await assert.rejects(endpoints.issue(require(
5757
'./input/credential-schema-non-url-id-fail.json')),
58-
{name: 'HTTPError'},
58+
5959
'Failed to reject `credentialSchema` with a numerid `id`.');
6060
});
6161

0 commit comments

Comments
 (0)