-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle channel_rename, reaction_removed, subteam_created, subteam_upd…
- Loading branch information
Showing
7 changed files
with
149 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const test = require('tape'); | ||
const mocks = require('./mocks'); | ||
|
||
test('slack_react', async(t) => { | ||
t.plan(1 + mocks.connectOneIrcClient.planCount); | ||
const c = await mocks.connectOneIrcClient(t); | ||
c.ircSocket.expect(':test_slack_user PRIVMSG #test_chan_1 :' + String.fromCharCode(1) + 'ACTION reacts @ test_slack_barr: sunglasses' + String.fromCharCode(1)); | ||
await c.daemon.onSlackReactionAdded(c.ircUser, { | ||
type: 'reaction_added', | ||
user: 'U1234USER', | ||
reaction: 'sunglasses', | ||
item_user: 'U1235BARR', | ||
item: { | ||
type: 'message', | ||
channel: 'C1234CHAN1', | ||
ts: '1360782400.498405', | ||
}, | ||
event_ts: '1360782804.083113', | ||
}); | ||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
const test = require('tape'); | ||
const mocks = require('./mocks'); | ||
|
||
test('slack_rename', async(t) => { | ||
t.plan(6 + mocks.connectOneIrcClient.planCount); | ||
const c = await mocks.connectOneIrcClient(t); | ||
c.slackWeb.expect('conversations.info', { channel: 'C1234CHAN1' }, { | ||
ok: true, | ||
channel: { | ||
id: 'C1234CHAN1', | ||
topic: { | ||
value: 'foobar topic here', | ||
}, | ||
}, | ||
}); | ||
c.slackWeb.expect('conversations.members', { channel: 'C1234CHAN1' }, { ok: true, members: [ | ||
'U1234USER', | ||
'U1235BARR', | ||
]}); | ||
c.ircSocket.expect(':test_slack_user PART #test_chan_1'); | ||
c.ircSocket.expect(':test_slack_user JOIN #test_chan_new'); | ||
c.ircSocket.expect(':irslackd 332 test_slack_user #test_chan_new :foobar topic here'); | ||
c.ircSocket.expect(':irslackd 353 test_slack_user = #test_chan_new :test_slack_user test_slack_user test_slack_barr'); | ||
await c.daemon.onSlackChannelRename(c.ircUser, { | ||
type: 'channel_rename', | ||
channel: { | ||
id: 'C1234CHAN1', | ||
name: 'test_chan_new', | ||
created: 1527736458, | ||
}, | ||
}); | ||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
const test = require('tape'); | ||
const mocks = require('./mocks'); | ||
|
||
test('slack_usergroup_updated', async(t) => { | ||
t.plan(1 + mocks.connectOneIrcClient.planCount); | ||
const c = await mocks.connectOneIrcClient(t); | ||
await c.daemon.onSlackSubteamUpdated(c.ircUser, { | ||
type: 'subteam_updated', | ||
subteam: { | ||
id: 'S1234GRP1', | ||
handle: 'newgroup1', | ||
}, | ||
}); | ||
c.slackWeb.expect('chat.postMessage', { | ||
channel: 'C1234CHAN1', | ||
text: 'hello <!subteam^S1234GRP1|@newgroup1>', | ||
as_user: true, | ||
thread_ts: null, | ||
}, { | ||
ok: true, | ||
channel: 'C1234CHAN1', | ||
ts: '1234.5678', | ||
}); | ||
await c.daemon.onIrcPrivmsg(c.ircUser, { args: [ '#test_chan_1', 'hello @newgroup1' ] }); | ||
await c.daemon.onSlackMessage(c.ircUser, { | ||
text: 'hello world <!subteam^S1234GRP1|@newgroup1>', | ||
user: 'U1234USER', | ||
channel: 'C1234CHAN1', | ||
ts: '1234.5678', | ||
}); | ||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
const test = require('tape'); | ||
const mocks = require('./mocks'); | ||
|
||
test('irc_whois', async(t) => { | ||
t.plan(2 + mocks.connectOneIrcClient.planCount); | ||
const c = await mocks.connectOneIrcClient(t); | ||
c.slackWeb.expect('users.info', { user: 'U1235QUUX' }, { | ||
ok: true, | ||
user: { | ||
name: 'test_slack_quux', | ||
real_name: 'John Quux', | ||
}, | ||
}); | ||
c.ircSocket.expect(':irslackd 311 = test_slack_quux test_slack_quux irslackd * :John Quux'); | ||
await c.daemon.onIrcWhois(c.ircUser, { args: [ 'test_slack_quux' ] }); | ||
t.end(); | ||
}); |