@@ -131,7 +131,8 @@ describe('Bot Events', function () {
131
131
// nick => '' means the user is not a special user
132
132
const nicks = { [ bot . nickname ] : '' , user : '' , user2 : '@' , user3 : '+' } ;
133
133
bot . ircClient . emit ( 'names' , channel , nicks ) ;
134
- bot . channelUsers . should . deep . equal ( { '#channel' : [ bot . nickname , 'user' , 'user2' , 'user3' ] } ) ;
134
+ const channelNicks = new Set ( [ bot . nickname , 'user' , 'user2' , 'user3' ] ) ;
135
+ bot . channelUsers . should . deep . equal ( { '#channel' : channelNicks } ) ;
135
136
} ) ;
136
137
137
138
it ( 'should send join messages to discord when config enabled' , function ( ) {
@@ -143,7 +144,8 @@ describe('Bot Events', function () {
143
144
const text = `*${ nick } * has joined the channel` ;
144
145
bot . ircClient . emit ( 'join' , channel , nick ) ;
145
146
bot . sendExactToDiscord . should . have . been . calledWithExactly ( channel , text ) ;
146
- bot . channelUsers . should . deep . equal ( { '#channel' : [ bot . nickname , nick ] } ) ;
147
+ const channelNicks = new Set ( [ bot . nickname , nick ] ) ;
148
+ bot . channelUsers . should . deep . equal ( { '#channel' : channelNicks } ) ;
147
149
} ) ;
148
150
149
151
it ( 'should not announce itself joining by default' , function ( ) {
@@ -154,7 +156,8 @@ describe('Bot Events', function () {
154
156
const nick = bot . nickname ;
155
157
bot . ircClient . emit ( 'join' , channel , nick ) ;
156
158
bot . sendExactToDiscord . should . not . have . been . called ;
157
- bot . channelUsers . should . deep . equal ( { '#channel' : [ bot . nickname ] } ) ;
159
+ const channelNicks = new Set ( [ bot . nickname ] ) ;
160
+ bot . channelUsers . should . deep . equal ( { '#channel' : channelNicks } ) ;
158
161
} ) ;
159
162
160
163
it ( 'should announce the bot itself when config enabled' , function ( ) {
@@ -175,21 +178,24 @@ describe('Bot Events', function () {
175
178
const channel = '#channel' ;
176
179
const nick = 'user' ;
177
180
bot . ircClient . emit ( 'names' , channel , { [ bot . nickname ] : '' , [ nick ] : '' } ) ;
178
- bot . channelUsers . should . deep . equal ( { '#channel' : [ bot . nickname , nick ] } ) ;
181
+ const originalNicks = new Set ( [ bot . nickname , nick ] ) ;
182
+ bot . channelUsers . should . deep . equal ( { '#channel' : originalNicks } ) ;
179
183
const reason = 'Leaving' ;
180
184
const text = `*${ nick } * has left the channel (${ reason } )` ;
181
185
bot . ircClient . emit ( 'part' , channel , nick , reason ) ;
182
186
bot . sendExactToDiscord . should . have . been . calledWithExactly ( channel , text ) ;
183
187
// it should remove the nickname from the channelUsers list
184
- bot . channelUsers . should . deep . equal ( { '#channel' : [ bot . nickname ] } ) ;
188
+ const channelNicks = new Set ( [ bot . nickname ] ) ;
189
+ bot . channelUsers . should . deep . equal ( { '#channel' : channelNicks } ) ;
185
190
} ) ;
186
191
187
192
it ( 'should not announce itself leaving a channel' , function ( ) {
188
193
const bot = createBot ( { ...config , ircStatusNotices : true } ) ;
189
194
bot . connect ( ) ;
190
195
const channel = '#channel' ;
191
196
bot . ircClient . emit ( 'names' , channel , { [ bot . nickname ] : '' , user : '' } ) ;
192
- bot . channelUsers . should . deep . equal ( { '#channel' : [ bot . nickname , 'user' ] } ) ;
197
+ const originalNicks = new Set ( [ bot . nickname , 'user' ] ) ;
198
+ bot . channelUsers . should . deep . equal ( { '#channel' : originalNicks } ) ;
193
199
const reason = 'Leaving' ;
194
200
bot . ircClient . emit ( 'part' , channel , bot . nickname , reason ) ;
195
201
bot . sendExactToDiscord . should . not . have . been . called ;
0 commit comments