diff --git a/service/recognition.js b/service/recognition.js index d1314e01..0fd77080 100644 --- a/service/recognition.js +++ b/service/recognition.js @@ -20,7 +20,7 @@ const tagRegex = /#(\S+)/g; const generalEmojiRegex = /:([a-z-_']+):/g; const gratitudeEmojiRegex = new RegExp(config.recognizeEmoji, "g"); const multiplierRegex = new RegExp( - `${config.recognizeEmoji}\\s*x([0-9]+)|x([0-9]+)\\s${config.recognizeEmoji}`, + `${config.recognizeEmoji}\\s*[Xx]([0-9]+)|[Xx]([0-9]+)\\s${config.recognizeEmoji}`, ); // TODO Can we add a 'count' field to the recognition? diff --git a/test/service/recognition.js b/test/service/recognition.js index 0bb3752e..593b2dc6 100644 --- a/test/service/recognition.js +++ b/test/service/recognition.js @@ -472,6 +472,20 @@ describe("service/recognition", () => { const result = recognition.gratitudeCountIn(text); expect(result).to.equal(5); }); + + it("should count uppercase multiplier", async () => { + const text = + "uppercase multiplier X5 :fistbump: <@TestUser> Test Message"; + const result = recognition.gratitudeCountIn(text); + expect(result).to.equal(5); + }); + + it("shouldn't use an uppercase multiplier that's not 'X'", async () => { + const text = + "uppercase fake multiplier Y5 :fistbump: <@TestUser> Test Message"; + const result = recognition.gratitudeCountIn(text); + expect(result).to.equal(1); + }); }); describe("gratitudeTagsIn", () => {