Skip to content
This repository was archived by the owner on Dec 8, 2017. It is now read-only.

Commit c4a6cd1

Browse files
author
Mike Bland
committed
Handle reaction_added messages
Just sends them straight through without any special treatment.
1 parent e757540 commit c4a6cd1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/client.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ class Client extends EventEmitter
500500
@reconnect()
501501
@emit 'team_migration_started', message
502502

503+
when 'reaction_added'
504+
@emit 'reaction_added', new Message(@, message)
505+
503506
else
504507
if message.reply_to
505508
if message.type == 'pong'

test/client.coffee

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
should = require 'should'
55
sinon = require 'sinon'
66
Client = require '../src/client'
7+
Message = require '../src/message'
78

89
# Generate a new instance for each test.
910
client = null
@@ -47,3 +48,23 @@ describe 'Client', ->
4748

4849
it 'should call reconnect', ->
4950
client.reconnect.called.should.equal true
51+
52+
describe 'type: reaction_added', ->
53+
message = {
54+
"type": "reaction_added"
55+
}
56+
57+
beforeEach ->
58+
sinon.stub(client, 'emit')
59+
client.onMessage message
60+
61+
afterEach ->
62+
client.emit.restore()
63+
64+
it 'should emit a reaction_added Message', ->
65+
client.emit.calledTwice.should.equal true
66+
client.emit.args[0].should.eql ['raw_message', message]
67+
68+
args = client.emit.args[1]
69+
args[0].should.eql 'reaction_added'
70+
args[1].type.should.eql message.type

0 commit comments

Comments
 (0)