@@ -124,18 +124,22 @@ describe('Bot Events', function () {
124
124
it ( 'should send name change event to discord' , function ( ) {
125
125
const channel1 = '#channel1' ;
126
126
const channel2 = '#channel2' ;
127
+ const channel3 = '#channel3' ;
127
128
const oldNick = 'user1' ;
128
129
const newNick = 'user2' ;
130
+ const user3 = 'user3' ;
129
131
const bot = createBot ( { ...config , ircStatusNotices : true } ) ;
132
+ const staticChannel = new Set ( [ bot . nickname , user3 ] ) ;
130
133
bot . connect ( ) ;
131
- bot . ircClient . emit ( 'names' , '#channel1' , { [ bot . nickname ] : '' , [ oldNick ] : '' } ) ;
134
+ bot . ircClient . emit ( 'names' , channel1 , { [ bot . nickname ] : '' , [ oldNick ] : '' } ) ;
135
+ bot . ircClient . emit ( 'names' , channel2 , { [ bot . nickname ] : '' , [ user3 ] : '' } ) ;
132
136
const channelNicksPre = new Set ( [ bot . nickname , oldNick ] ) ;
133
- bot . channelUsers . should . deep . equal ( { '#channel1' : channelNicksPre } ) ;
137
+ bot . channelUsers . should . deep . equal ( { '#channel1' : channelNicksPre , '#channel2' : staticChannel } ) ;
134
138
const formattedText = `*${ oldNick } * is now known as ${ newNick } ` ;
135
139
const channelNicksAfter = new Set ( [ bot . nickname , newNick ] ) ;
136
- bot . ircClient . emit ( 'nick' , oldNick , newNick , [ channel1 , channel2 ] ) ;
140
+ bot . ircClient . emit ( 'nick' , oldNick , newNick , [ channel1 , channel2 , channel3 ] ) ;
137
141
bot . sendExactToDiscord . should . have . been . calledWithExactly ( channel1 , formattedText ) ;
138
- bot . channelUsers . should . deep . equal ( { '#channel1' : channelNicksAfter } ) ;
142
+ bot . channelUsers . should . deep . equal ( { '#channel1' : channelNicksAfter , '#channel2' : staticChannel } ) ;
139
143
} ) ;
140
144
141
145
it ( 'should send actions to discord' , function ( ) {
0 commit comments