diff --git a/src/utils/isMessageForBot.js b/src/utils/isMessageForBot.js index 16bb13f3..ca0282bb 100644 --- a/src/utils/isMessageForBot.js +++ b/src/utils/isMessageForBot.js @@ -1,7 +1,9 @@ function isMessageForBot(message) { + const lowerCaseMessage = message.toLowerCase() const isMessageForBot = - message.includes(`@all-contributors`) || - message.includes(`@allcontributors[bot]`) + lowerCaseMessage.includes(`@all-contributors`) || + lowerCaseMessage.includes(`@allcontributors`) || + lowerCaseMessage.includes(`@allcontributors[bot]`) return isMessageForBot } diff --git a/test/utils/isMessageForBot.test.js b/test/utils/isMessageForBot.test.js index 966f4652..b70ff87a 100644 --- a/test/utils/isMessageForBot.test.js +++ b/test/utils/isMessageForBot.test.js @@ -1,12 +1,10 @@ const isMessageForBot = require('../../src/utils/isMessageForBot') describe('isMessageForBot', () => { - const testBotName = 'all-contributors' - test('For us', () => { expect( isMessageForBot( - `@${testBotName} please add jakebolam for doc, infra and code`, + `@all-contributors please add jakebolam for doc, infra and code`, ), ).toBe(true) @@ -15,12 +13,26 @@ describe('isMessageForBot', () => { `@allcontributors[bot] please add jakebolam for doc, infra and code`, ), ).toBe(true) + + expect( + isMessageForBot( + `@allcontributors please add jakebolam for doc, infra and code`, + ), + ).toBe(true) + }) + + test('For us, case in-sensitive', () => { + expect( + isMessageForBot( + `@aLL-conTRIBUtors please add jakebolam for doc, infra and code`, + ), + ).toBe(true) }) test('Not for us', () => { expect( isMessageForBot( - `${testBotName} please add jakebolam for doc, infra and code`, + `all-contributors please add jakebolam for doc, infra and code`, ), ).toBe(false)