Skip to content

Commit

Permalink
Add infrastructure for known failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kewisch committed Apr 21, 2024
1 parent b804030 commit 76ce13a
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/failure_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import assert from "assert";


/**
* The tests in this suite are known to fail, due to a bug in the library. If the tests here start
* failing in the sense of mocha, then the test is passing and you have either:
*
* 1) Fixed the bug (yay! remove the test)
* 2) Triggered some unknown underlying issue (boo! investigate)
*
* When adding something here, make sure to link the issue.
*/
suite('Known failures', function() {
function testKnownFailure(message, testFn, only) {
let runner = only ? test.only : test;
runner(message, function(done) {
try {
testFn(done);
done(new Error("Expected test fo fail"));
} catch (e) {
if (e instanceof assert.AssertionError) {
this.skip();
} else {
done(e);
}
}
});
}
testKnownFailure.only = function(message, testFn) {
return testKnownFailure(message, testFn, true);
};

// Escaped parameters are not correctly parsed
// Please see https://github.com/kewisch/ical.js/issues/669
testKnownFailure('Parameter escaping', function() {
let subject = ICAL.Property.fromString(`ATTENDEE;CN="Z\\;":mailto:z@example.org`);
assert.equal(subject.getParameter("cn"), "Z\\;");
assert.equal(subject.getFirstValue(), "mailto:z@example.org");
});
});

0 comments on commit 76ce13a

Please sign in to comment.