w3c / vc-data-model-2.0-test-suite

W3C Verifiable Credentials v2.0 test suite
https://w3c.github.io/vc-data-model-2.0-test-suite/
Other
11 stars 15 forks source link

Replace assert rejects and doesNotReject with chai assertions on status code and verification results #126

Open aljones15 opened 2 weeks ago

aljones15 commented 2 weeks ago

Related: https://github.com/w3c/vc-data-model-2.0-test-suite/issues/4

Existing assertions can be re-used to assert on status codes:

https://github.com/w3c-ccg/data-integrity-test-suite-assertion/blob/52bd29227a99a45d79bf437437d0ea379e4a0e46/assertions.js#L25-L56

https://github.com/w3c-ccg/data-integrity-test-suite-assertion/blob/52bd29227a99a45d79bf437437d0ea379e4a0e46/assertions.js#L244-L280

If possible re-use these common issuance and failure assertions.

aljones15 commented 3 days ago

please note that the current use of assert.rejects and assert.doesNotReject causes issues when a test fails do to an internal reason such as test data is missing or an implementation is missing an endpoint needed for a test. We should be at a minimum asserting on an HTTP status code 400 for negative tests. Checking for a status code at least avoids cases where a promise throws for a reason not related to the test at hand.