From 76ce13ac9ff0c12c3e105a0e71280126b516a55e Mon Sep 17 00:00:00 2001 From: Philipp Kewisch Date: Sun, 21 Apr 2024 16:54:46 +0200 Subject: [PATCH] Add infrastructure for known failing tests --- test/failure_test.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/failure_test.js diff --git a/test/failure_test.js b/test/failure_test.js new file mode 100644 index 00000000..32b84be2 --- /dev/null +++ b/test/failure_test.js @@ -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"); + }); +});