Skip to content

Commit 76ce13a

Browse files
committed
Add infrastructure for known failing tests
1 parent b804030 commit 76ce13a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/failure_test.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import assert from "assert";
2+
3+
4+
/**
5+
* The tests in this suite are known to fail, due to a bug in the library. If the tests here start
6+
* failing in the sense of mocha, then the test is passing and you have either:
7+
*
8+
* 1) Fixed the bug (yay! remove the test)
9+
* 2) Triggered some unknown underlying issue (boo! investigate)
10+
*
11+
* When adding something here, make sure to link the issue.
12+
*/
13+
suite('Known failures', function() {
14+
function testKnownFailure(message, testFn, only) {
15+
let runner = only ? test.only : test;
16+
runner(message, function(done) {
17+
try {
18+
testFn(done);
19+
done(new Error("Expected test fo fail"));
20+
} catch (e) {
21+
if (e instanceof assert.AssertionError) {
22+
this.skip();
23+
} else {
24+
done(e);
25+
}
26+
}
27+
});
28+
}
29+
testKnownFailure.only = function(message, testFn) {
30+
return testKnownFailure(message, testFn, true);
31+
};
32+
33+
// Escaped parameters are not correctly parsed
34+
// Please see https://github.com/kewisch/ical.js/issues/669
35+
testKnownFailure('Parameter escaping', function() {
36+
let subject = ICAL.Property.fromString(`ATTENDEE;CN="Z\\;":mailto:[email protected]`);
37+
assert.equal(subject.getParameter("cn"), "Z\\;");
38+
assert.equal(subject.getFirstValue(), "mailto:[email protected]");
39+
});
40+
});

0 commit comments

Comments
 (0)