diff --git a/src/client.coffee b/src/client.coffee index 590fcdeb..66916ead 100644 --- a/src/client.coffee +++ b/src/client.coffee @@ -39,7 +39,9 @@ class SlackClient # Map to convert bot user IDs (BXXXXXXXX) to user representations for events from custom # integrations and apps without a bot user - @botUserIdMap = {} + @botUserIdMap = { + "B01": { id: "B01", user_id: "USLACKBOT" } + } # Map to convert conversation IDs to conversation representations @channelData = {} diff --git a/test/client.coffee b/test/client.coffee index 20beb9ce..cc127c17 100644 --- a/test/client.coffee +++ b/test/client.coffee @@ -312,6 +312,14 @@ describe 'fetchBotUser()', -> result = @client.fetchBotUser @stubs.bot.id result.should.be.Promise() + it 'should return constant data if id is slackbots id', -> + user = @stubs.slack_bot + @client.fetchBotUser @stubs.slack_bot.id + .then((res) -> + res.id.should.equal user.id + res.user_id.should.equal user.user_id + ) + describe 'fetchUser()', -> it 'should return user representation from brain', -> user = @stubs.user diff --git a/test/stubs.coffee b/test/stubs.coffee index 66056e43..855c9124 100644 --- a/test/stubs.coffee +++ b/test/stubs.coffee @@ -83,6 +83,10 @@ beforeEach -> @stubs.undefined_user_bot = name: 'testbot' id: 'B789' + @stubs.slack_bot = + name: 'slackbot' + id: 'B01' + user_id: 'USLACKBOT' @stubs.self = name: 'self' id: 'U456'