Skip to content

Commit f5175dd

Browse files
committed
add attachment function
Signed-off-by: PatStLouis <[email protected]>
1 parent d63b241 commit f5175dd

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

tests/4-5-types.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
* SPDX-License-Identifier: LicenseRef-w3c-3-clause-bsd-license-2008 OR LicenseRef-w3c-test-suite-license-2023
55
*/
66

7-
import {addPerTestMetadata, setupMatrix} from './helpers.js';
7+
import * as allure from 'allure-js-commons';
8+
import {addJsonAttachment, addPerTestMetadata, setupMatrix} from './helpers.js';
89
import assert from 'node:assert/strict';
910
import chai from 'chai';
11+
import {ContentType} from 'allure-js-commons';
1012
import {createLocalVp} from './data-generator.js';
1113
import {createRequire} from 'module';
1214
import {filterByTag} from 'vc-test-suite-implementations';
@@ -32,6 +34,10 @@ describe('Types', function() {
3234
it('Verifiable credentials MUST contain a type property with an ' +
3335
'associated value.', async function() {
3436
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.`;
37+
await addJsonAttachment(
38+
'credential-no-type-fail.json',
39+
require('./input/credential-no-type-fail.json')
40+
);
3541
await assert.rejects(
3642
endpoints.issue(require('./input/credential-no-type-fail.json')),
3743
{name: 'HTTPError'},

tests/helpers.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import * as allure from 'allure-js-commons';
2+
import {ContentType} from 'allure-js-commons';
3+
14
export function setupMatrix(match) {
25
// this will tell the report
36
// to make an interop matrix with this suite
@@ -36,3 +39,11 @@ export function extractIfEnveloped(input) {
3639
return input;
3740
}
3841
}
42+
export async function addJsonAttachment(fileName, content) {
43+
// append test meta data to the it/test this.
44+
await allure.attachment(
45+
fileName,
46+
content,
47+
ContentType.JSON
48+
);
49+
}

0 commit comments

Comments
 (0)