forked from slackapi/node-slack-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.coffee
49 lines (38 loc) · 1.27 KB
/
client.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
###################################################################
# Setup the tests
###################################################################
should = require 'should'
sinon = require 'sinon'
Client = require '../src/client'
# Generate a new instance for each test.
client = null
beforeEach ->
client = new Client
###################################################################
# Start the tests
###################################################################
describe 'Client', ->
describe '#getChannelByName', ->
beforeEach ->
client.channels =
chan1:
name: "achan"
chan2:
name: "bchan"
it 'should return a named channel', ->
chan = client.getChannelByName 'achan'
chan.name.should.equal 'achan'
it 'should strip hashes from the channel name', ->
chan = client.getChannelByName '#bchan'
chan.name.should.equal 'bchan'
describe '#onMessage', ->
describe 'type: team_migration_started', ->
beforeEach ->
sinon.stub(client, 'reconnect')
client.onMessage {
"type": "team_migration_started"
}
afterEach ->
client.reconnect.restore()
it 'should call reconnect', ->
client.reconnect.called.should.equal true