Skip to content

Commit 3852c59

Browse files
committed
Allow the ZCAP expiration test to fail.
We do not want to block the build, only report. However, these will likely get missed now...but at least someone can check the logs...
1 parent e654583 commit 3852c59

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

test/implementations.spec.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ import chaiDateTime from 'chai-datetime';
99
const should = chai.should();
1010
chai.use(chaiDateTime);
1111

12+
// from https://github.com/mochajs/mocha/issues/1480#issuecomment-487074628
13+
it.allowFail = (title, callback) => {
14+
it(title, function() {
15+
return Promise.resolve().then(() => {
16+
return callback.apply(this, arguments);
17+
}).catch(() => {
18+
this.skip();
19+
});
20+
});
21+
};
22+
1223
import {allImplementations, rawImplementations} from '../lib/main.js';
1324

1425
describe('Loading implementations', () => {
@@ -54,13 +65,18 @@ describe('Loading implementations', () => {
5465
implementation[implementationType]
5566
?.filter(({zcap}) => zcap?.capability)
5667
.forEach(config => {
57-
it(`ZCAP should not be expired for ${config.id}`, () => {
58-
const expiration = JSON.parse(config.zcap.capability).expires;
59-
const today = new Date();
60-
const nextMonth = new Date(
61-
today.getFullYear(), today.getMonth() + 1, today.getDate());
62-
chai.expect(new Date(expiration)).to.be.afterDate(nextMonth);
63-
});
68+
it.allowFail(`ZCAP should not be expired for ${config.id}`,
69+
() => {
70+
const expiration = JSON.parse(config.zcap.capability)
71+
.expires;
72+
const today = new Date();
73+
const nextMonth = new Date(
74+
today.getFullYear(), today.getMonth() + 1,
75+
today.getDate());
76+
chai.expect(new Date(expiration)).to.be
77+
.afterDate(nextMonth);
78+
}
79+
);
6480

6581
it(`The "endpoint" MUST match the "invocationTarget" in the
6682
ZCAP for ${config.id}`, () => {

0 commit comments

Comments
 (0)