From 4f2fde4a48e7d3a40979a314e3a95f881de687ab Mon Sep 17 00:00:00 2001 From: Sorunome <mail@sorunome.de> Date: Sun, 28 Apr 2019 12:03:56 +0200 Subject: [PATCH] add test --- test/test_util.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/test_util.ts b/test/test_util.ts index 3abf37a..8838036 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"); + }); + }); }); -- GitLab