This repository was archived by the owner on Dec 8, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,9 @@ class Client extends EventEmitter
500
500
@ reconnect ()
501
501
@ emit ' team_migration_started' , message
502
502
503
+ when ' reaction_added'
504
+ @ emit ' reaction_added' , new Message (@ , message)
505
+
503
506
else
504
507
if message .reply_to
505
508
if message .type == ' pong'
Original file line number Diff line number Diff line change 4
4
should = require ' should'
5
5
sinon = require ' sinon'
6
6
Client = require ' ../src/client'
7
+ Message = require ' ../src/message'
7
8
8
9
# Generate a new instance for each test.
9
10
client = null
@@ -47,3 +48,23 @@ describe 'Client', ->
47
48
48
49
it ' should call reconnect' , ->
49
50
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
You can’t perform that action at this time.
0 commit comments