From 13c468c7684d743cd3adb745f617b733b4e04918 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Wed, 27 Mar 2019 21:37:57 -0700 Subject: [PATCH] Fix test --- test/channel/voteskip.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/channel/voteskip.js b/test/channel/voteskip.js index 02997306..da5f3f81 100644 --- a/test/channel/voteskip.js +++ b/test/channel/voteskip.js @@ -43,12 +43,17 @@ describe('VoteskipModule', () => { } }, playlist: { + _playNext() { + }, + meta: { count: 1 } } }, - users: [fakeUser] + users: [fakeUser], + broadcastAll() { + } }; voteskipModule = new VoteskipModule(fakeChannel); @@ -79,6 +84,20 @@ describe('VoteskipModule', () => { assert(reset, 'Expected voteskip to be reset'); assert(playNext, 'Expected playlist to be advanced'); }); + + it('broadcasts a message', () => { + let sentMessage = false; + fakeChannel.broadcastAll = (frame, data) => { + assert.strictEqual(frame, 'chatMsg'); + assert(/voteskip passed/i.test(data.msg), 'Expected voteskip passed message') + sentMessage = true; + }; + voteskipModule.poll = { + counts: [1] + }; + voteskipModule.update(); + assert(sentMessage, 'Expected voteskip passed message'); + }); }); describe('#calcUsercounts', () => {