File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 11function isMessageForBot ( message ) {
2+ const lowerCaseMessage = message . toLowerCase ( )
23 const isMessageForBot =
3- message . includes ( `@all-contributors` ) ||
4- message . includes ( `@allcontributors[bot]` )
4+ lowerCaseMessage . includes ( `@all-contributors` ) ||
5+ lowerCaseMessage . includes ( `@allcontributors` ) ||
6+ lowerCaseMessage . includes ( `@allcontributors[bot]` )
57 return isMessageForBot
68}
79
Original file line number Diff line number Diff line change 11const isMessageForBot = require ( '../../src/utils/isMessageForBot' )
22
33describe ( 'isMessageForBot' , ( ) => {
4- const testBotName = 'all-contributors'
5-
64 test ( 'For us' , ( ) => {
75 expect (
86 isMessageForBot (
9- `@${ testBotName } please add jakebolam for doc, infra and code` ,
7+ `@all-contributors please add jakebolam for doc, infra and code` ,
108 ) ,
119 ) . toBe ( true )
1210
@@ -15,12 +13,26 @@ describe('isMessageForBot', () => {
1513 `@allcontributors[bot] please add jakebolam for doc, infra and code` ,
1614 ) ,
1715 ) . toBe ( true )
16+
17+ expect (
18+ isMessageForBot (
19+ `@allcontributors please add jakebolam for doc, infra and code` ,
20+ ) ,
21+ ) . toBe ( true )
22+ } )
23+
24+ test ( 'For us, case in-sensitive' , ( ) => {
25+ expect (
26+ isMessageForBot (
27+ `@aLL-conTRIBUtors please add jakebolam for doc, infra and code` ,
28+ ) ,
29+ ) . toBe ( true )
1830 } )
1931
2032 test ( 'Not for us' , ( ) => {
2133 expect (
2234 isMessageForBot (
23- `${ testBotName } please add jakebolam for doc, infra and code` ,
35+ `all-contributors please add jakebolam for doc, infra and code` ,
2436 ) ,
2537 ) . toBe ( false )
2638
You can’t perform that action at this time.
0 commit comments