@@ -34,6 +34,9 @@ test('checks a message and finds a global trigger', async () => {
3434 const body = 'I want to .deploy'
3535 const trigger = '.deploy'
3636 expect ( await triggerCheck ( body , trigger ) ) . toBe ( false )
37+ expect ( debugMock ) . toHaveBeenCalledWith (
38+ `comment body does not start with trigger: ${ color } .deploy${ colorReset } `
39+ )
3740} )
3841
3942test ( 'checks a message and finds a trigger with an environment and a variable' , async ( ) => {
@@ -52,3 +55,27 @@ test('checks a message and does not find global trigger', async () => {
5255 `comment body does not start with trigger: ${ color } .deploy${ colorReset } `
5356 )
5457} )
58+
59+ test ( 'does not match when body starts with a longer command sharing prefix' , async ( ) => {
60+ const body = '.deploy-two to prod'
61+ const trigger = '.deploy'
62+ expect ( await triggerCheck ( body , trigger ) ) . toBe ( false )
63+ expect ( debugMock ) . toHaveBeenCalledWith (
64+ `comment body starts with trigger but is not complete: ${ color } .deploy${ colorReset } `
65+ )
66+ } )
67+
68+ test ( 'does not match when immediately followed by alphanumeric' , async ( ) => {
69+ const body = '.deploy1'
70+ const trigger = '.deploy'
71+ expect ( await triggerCheck ( body , trigger ) ) . toBe ( false )
72+ expect ( debugMock ) . toHaveBeenCalledWith (
73+ `comment body starts with trigger but is not complete: ${ color } .deploy${ colorReset } `
74+ )
75+ } )
76+
77+ test ( 'matches when followed by a newline (whitespace)' , async ( ) => {
78+ const body = `.deploy\ndev`
79+ const trigger = '.deploy'
80+ expect ( await triggerCheck ( body , trigger ) ) . toBe ( true )
81+ } )
0 commit comments