Skip to content

Commit a859805

Browse files
committed
test: log warning instead of throwing error for unknown events
1 parent 24358e4 commit a859805

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/unit/event-handler-on-test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const simple = require('simple-mock')
12
const test = require('tap').test
23

34
const receiverOn = require('../../event-handler/on')
@@ -9,8 +10,11 @@ const state = {
910
}
1011

1112
test('receiver.on with invalid event name', t => {
12-
t.throws(() => {
13-
receiverOn(state, 'foo', noop)
14-
})
13+
simple.mock(console, 'warn').callFn(function () {})
14+
receiverOn(state, 'foo', noop)
15+
t.equals(console.warn.callCount, 1)
16+
t.equals(console.warn.lastCall.arg, '"foo" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)')
17+
18+
simple.restore()
1519
t.end()
1620
})

0 commit comments

Comments
 (0)