diff --git a/test/test_util.ts b/test/test_util.ts index 3abf37a66dcc22ac4bee0d26631c08c63b5a764d..88380369b0ce0c8b620be061e30aa155aba227b4 100644 --- a/test/test_util.ts +++ b/test/test_util.ts @@ -158,4 +158,25 @@ describe("Util", () => { expect(reply).to.equal("#000000"); }); }); + describe("ApplyPatternString", () => { + it("Should apply simple patterns", () => { + const reply = Util.ApplyPatternString(":name likes :animal", { + animal: "Foxies", + name: "Sorunome", + }); + expect(reply).to.equal("Sorunome likes Foxies"); + }); + it("Should ignore unused tags", () => { + const reply = Util.ApplyPatternString(":name is :thing", { + name: "Sorunome", + }); + expect(reply).to.equal("Sorunome is :thing"); + }); + it("Should do multi-replacements", () => { + const reply = Util.ApplyPatternString(":animal, :animal and :animal", { + animal: "fox", + }); + expect(reply).to.equal("fox, fox and fox"); + }); + }); });