From 7cf2eb26af5159c9b393747f7f9adad59eb8e4c9 Mon Sep 17 00:00:00 2001 From: Ankur Oberoi Date: Mon, 16 Jul 2018 19:04:26 -0700 Subject: [PATCH] update tests for new enter and leave events --- test/bot.coffee | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/test/bot.coffee b/test/bot.coffee index 59c14da3..29a62176 100644 --- a/test/bot.coffee +++ b/test/bot.coffee @@ -74,10 +74,10 @@ describe 'Disable Sync', -> @slackbot.options.disableUserSync = true @slackbot.run() @slackbot.robot.brain.data.users.should.be.empty() - + # Test moved to fetchUsers() in client.coffee because of change in code logic #it 'Should still sync interacting users when disabled' - + describe 'Send Messages', -> it 'Should send a message', -> @@ -207,13 +207,13 @@ describe 'Handling incoming messages', -> @slackbot.eventHandler messageData return - it 'Should handle channel_join events as envisioned', -> - @slackbot.eventHandler {type: 'message', subtype: 'channel_join', user: @stubs.user, channel: @stubs.channel.id} + it 'Should handle member_joined_channel events as envisioned', -> + @slackbot.eventHandler {type: 'member_joined_channel', user: @stubs.user, channel: @stubs.channel.id} should.equal (@stubs._received instanceof EnterMessage), true @stubs._received.user.id.should.equal @stubs.user.id - it 'Should handle channel_leave events as envisioned', -> - @slackbot.eventHandler {type: 'message', subtype: 'channel_leave', user: @stubs.user, channel: @stubs.channel.id} + it 'Should handle member_left_channel events as envisioned', -> + @slackbot.eventHandler {type: 'member_left_channel', user: @stubs.user, channel: @stubs.channel.id} should.equal (@stubs._received instanceof LeaveMessage), true @stubs._received.user.id.should.equal @stubs.user.id @@ -222,16 +222,6 @@ describe 'Handling incoming messages', -> should.equal (@stubs._received instanceof TopicMessage), true @stubs._received.user.id.should.equal @stubs.user.id - it 'Should handle group_join events as envisioned', -> - @slackbot.eventHandler {type: 'message', subtype: 'group_join', user: @stubs.user, channel: @stubs.channel.id} - should.equal (@stubs._received instanceof EnterMessage), true - @stubs._received.user.id.should.equal @stubs.user.id - - it 'Should handle group_leave events as envisioned', -> - @slackbot.eventHandler {type: 'message', subtype: 'group_leave', user: @stubs.user, channel: @stubs.channel.id} - should.equal (@stubs._received instanceof LeaveMessage), true - @stubs._received.user.id.should.equal @stubs.user.id - it 'Should handle group_topic events as envisioned', -> @slackbot.eventHandler {type: 'message', subtype: 'group_topic', user: @stubs.user, channel: @stubs.channel.id} should.equal (@stubs._received instanceof TopicMessage), true