diff --git a/lib/shared/markdown.test.js b/lib/shared/markdown.test.js --- a/lib/shared/markdown.test.js +++ b/lib/shared/markdown.test.js @@ -51,4 +51,34 @@ expect('|| \n\ ||').not.toMatch(spoilerRegex); }); + + it("We expect to extract 'hello' from the following spoiler: ||hello||", () => { + var spoiler = '||hello||'; + var extracted = spoiler.match(spoilerRegex); + expect(extracted ? extracted[0] : null).toMatch('hello'); + }); + + it("We expect to extract '||' from the following spoiler: ||||||", () => { + var spoiler = '||||||'; + var extracted = spoiler.match(spoilerRegex); + expect(extracted ? extracted[0] : null).toMatch('||'); + }); + + it("We expect to extract ' ' from the following spoiler: || || ||", () => { + var spoiler = '|| || ||'; + var extracted = spoiler.match(spoilerRegex); + expect(extracted ? extracted[0] : null).toMatch(' '); + }); + + it("We expect to extract '||THISISASPOILER||' from the following spoiler: ||||THISISASPOILER||||", () => { + var spoiler = '||||THISISASPOILER||||'; + var extracted = spoiler.match(spoilerRegex); + expect(extracted ? extracted[0] : null).toMatch('||THISISASPOILER||'); + }); + + it("We expect to extract '' from the following spoiler: || \\|\\| ||", () => { + var spoiler = '|| \\|\\| ||'; + var extracted = spoiler.match(spoilerRegex); + expect(extracted ? extracted[0] : null).toMatch(' \\|\\| '); + }); });