agent-messenger 2.10.0 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/package.json +1 -1
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +15 -2
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/dist/src/shared/chromium/decryptor.d.ts +6 -0
- package/dist/src/shared/chromium/decryptor.d.ts.map +1 -1
- package/dist/src/shared/chromium/decryptor.js +26 -6
- package/dist/src/shared/chromium/decryptor.js.map +1 -1
- package/e2e/channeltalk.e2e.test.ts +13 -13
- package/e2e/channeltalkbot.e2e.test.ts +13 -13
- package/e2e/discord.e2e.test.ts +24 -24
- package/e2e/discordbot.e2e.test.ts +16 -16
- package/e2e/instagram.e2e.test.ts +10 -10
- package/e2e/kakaotalk.e2e.test.ts +7 -7
- package/e2e/line.e2e.test.ts +8 -8
- package/e2e/slack.e2e.test.ts +34 -34
- package/e2e/slackbot.e2e.test.ts +14 -14
- package/e2e/teams.e2e.test.ts +23 -23
- package/e2e/telegram.e2e.test.ts +8 -8
- package/e2e/webex.e2e.test.ts +14 -14
- package/e2e/whatsapp.e2e.test.ts +8 -8
- package/e2e/whatsappbot.e2e.test.ts +6 -6
- package/package.json +1 -1
- package/skills/agent-channeltalk/SKILL.md +1 -1
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +1 -1
- package/skills/agent-discordbot/SKILL.md +1 -1
- package/skills/agent-instagram/SKILL.md +1 -1
- package/skills/agent-kakaotalk/SKILL.md +1 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +1 -1
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +1 -1
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +1 -1
- package/skills/agent-wechatbot/SKILL.md +1 -1
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +1 -1
- package/src/platforms/channeltalk/client.test.ts +26 -26
- package/src/platforms/channeltalk/commands/auth.test.ts +16 -16
- package/src/platforms/channeltalk/commands/bot.test.ts +2 -2
- package/src/platforms/channeltalk/commands/chat.test.ts +3 -3
- package/src/platforms/channeltalk/commands/group.test.ts +4 -4
- package/src/platforms/channeltalk/commands/manager.test.ts +2 -2
- package/src/platforms/channeltalk/commands/message.test.ts +17 -17
- package/src/platforms/channeltalk/commands/snapshot.test.ts +7 -7
- package/src/platforms/channeltalk/commands/whoami.test.ts +3 -3
- package/src/platforms/channeltalk/credential-manager.test.ts +18 -18
- package/src/platforms/channeltalk/ensure-auth.test.ts +5 -5
- package/src/platforms/channeltalk/index.test.ts +23 -23
- package/src/platforms/channeltalk/token-extractor.test.ts +21 -21
- package/src/platforms/channeltalk/types.test.ts +12 -12
- package/src/platforms/channeltalkbot/client.test.ts +14 -14
- package/src/platforms/channeltalkbot/commands/auth.test.ts +16 -16
- package/src/platforms/channeltalkbot/commands/bot.test.ts +6 -6
- package/src/platforms/channeltalkbot/commands/chat.test.ts +9 -9
- package/src/platforms/channeltalkbot/commands/group.test.ts +6 -6
- package/src/platforms/channeltalkbot/commands/manager.test.ts +3 -3
- package/src/platforms/channeltalkbot/commands/message.test.ts +10 -10
- package/src/platforms/channeltalkbot/commands/snapshot.test.ts +7 -7
- package/src/platforms/channeltalkbot/commands/whoami.test.ts +4 -4
- package/src/platforms/channeltalkbot/credential-manager.test.ts +27 -27
- package/src/platforms/channeltalkbot/index.test.ts +15 -15
- package/src/platforms/discord/client.test.ts +28 -28
- package/src/platforms/discord/commands/auth.test.ts +7 -7
- package/src/platforms/discord/commands/channel.test.ts +7 -7
- package/src/platforms/discord/commands/dm.test.ts +4 -4
- package/src/platforms/discord/commands/file.test.ts +4 -4
- package/src/platforms/discord/commands/friend.test.ts +6 -6
- package/src/platforms/discord/commands/member.test.ts +5 -5
- package/src/platforms/discord/commands/mention.test.ts +5 -5
- package/src/platforms/discord/commands/message.test.ts +9 -9
- package/src/platforms/discord/commands/note.test.ts +6 -6
- package/src/platforms/discord/commands/profile.test.ts +4 -4
- package/src/platforms/discord/commands/reaction.test.ts +5 -5
- package/src/platforms/discord/commands/server.test.ts +7 -7
- package/src/platforms/discord/commands/snapshot.test.ts +6 -6
- package/src/platforms/discord/commands/thread.test.ts +6 -6
- package/src/platforms/discord/commands/user.test.ts +5 -5
- package/src/platforms/discord/commands/whoami.test.ts +6 -6
- package/src/platforms/discord/credential-manager.test.ts +16 -16
- package/src/platforms/discord/ensure-auth.test.ts +8 -8
- package/src/platforms/discord/index.test.ts +17 -17
- package/src/platforms/discord/listener.test.ts +33 -33
- package/src/platforms/discord/token-extractor.test.ts +53 -53
- package/src/platforms/discord/types.test.ts +26 -26
- package/src/platforms/discordbot/client.test.ts +31 -31
- package/src/platforms/discordbot/commands/auth.test.ts +18 -18
- package/src/platforms/discordbot/commands/channel.test.ts +11 -11
- package/src/platforms/discordbot/commands/file.test.ts +7 -7
- package/src/platforms/discordbot/commands/message.test.ts +25 -25
- package/src/platforms/discordbot/commands/reaction.test.ts +6 -6
- package/src/platforms/discordbot/commands/server.test.ts +12 -12
- package/src/platforms/discordbot/commands/snapshot.test.ts +13 -13
- package/src/platforms/discordbot/commands/thread.test.ts +10 -10
- package/src/platforms/discordbot/commands/user.test.ts +9 -9
- package/src/platforms/discordbot/commands/whoami.test.ts +4 -4
- package/src/platforms/discordbot/credential-manager.test.ts +28 -28
- package/src/platforms/instagram/client.test.ts +18 -18
- package/src/platforms/instagram/commands/auth.test.ts +11 -11
- package/src/platforms/instagram/commands/chat.test.ts +6 -6
- package/src/platforms/instagram/commands/message.test.ts +11 -11
- package/src/platforms/instagram/commands/shared.test.ts +12 -12
- package/src/platforms/instagram/commands/whoami.test.ts +3 -3
- package/src/platforms/instagram/credential-manager.test.ts +21 -21
- package/src/platforms/instagram/ensure-auth.test.ts +4 -4
- package/src/platforms/instagram/index.test.ts +9 -9
- package/src/platforms/instagram/listener.test.ts +8 -8
- package/src/platforms/instagram/token-extractor.test.ts +35 -35
- package/src/platforms/kakaotalk/client.test.ts +33 -33
- package/src/platforms/kakaotalk/commands/auth.test.ts +11 -11
- package/src/platforms/kakaotalk/commands/chat.test.ts +6 -6
- package/src/platforms/kakaotalk/commands/message.test.ts +7 -7
- package/src/platforms/kakaotalk/commands/whoami.test.ts +5 -5
- package/src/platforms/kakaotalk/credential-manager.test.ts +15 -15
- package/src/platforms/kakaotalk/index.test.ts +15 -15
- package/src/platforms/kakaotalk/listener.test.ts +17 -17
- package/src/platforms/line/client.test.ts +17 -17
- package/src/platforms/line/commands/auth.test.ts +8 -8
- package/src/platforms/line/commands/chat.test.ts +7 -7
- package/src/platforms/line/commands/friend.test.ts +6 -6
- package/src/platforms/line/commands/message.test.ts +7 -7
- package/src/platforms/line/commands/whoami.test.ts +6 -6
- package/src/platforms/line/credential-manager.test.ts +17 -17
- package/src/platforms/line/index.test.ts +10 -10
- package/src/platforms/line/listener.test.ts +15 -15
- package/src/platforms/line/types.test.ts +14 -14
- package/src/platforms/slack/cli.test.ts +8 -8
- package/src/platforms/slack/client.test.ts +151 -151
- package/src/platforms/slack/commands/activity.test.ts +13 -13
- package/src/platforms/slack/commands/auth.test.ts +34 -34
- package/src/platforms/slack/commands/bookmark.test.ts +9 -9
- package/src/platforms/slack/commands/channel.test.ts +17 -17
- package/src/platforms/slack/commands/drafts.test.ts +7 -7
- package/src/platforms/slack/commands/emoji.test.ts +3 -3
- package/src/platforms/slack/commands/file.test.ts +12 -12
- package/src/platforms/slack/commands/message.test.ts +19 -19
- package/src/platforms/slack/commands/pin.test.ts +7 -7
- package/src/platforms/slack/commands/reaction.test.ts +10 -10
- package/src/platforms/slack/commands/reminder.test.ts +9 -9
- package/src/platforms/slack/commands/saved.test.ts +7 -7
- package/src/platforms/slack/commands/sections.test.ts +5 -5
- package/src/platforms/slack/commands/snapshot.test.ts +13 -13
- package/src/platforms/slack/commands/unread.test.ts +6 -6
- package/src/platforms/slack/commands/user.test.ts +10 -10
- package/src/platforms/slack/commands/usergroup.test.ts +15 -15
- package/src/platforms/slack/commands/whoami.test.ts +6 -6
- package/src/platforms/slack/commands/workspace.test.ts +26 -26
- package/src/platforms/slack/credential-manager.test.ts +14 -14
- package/src/platforms/slack/ensure-auth.test.ts +21 -21
- package/src/platforms/slack/index.test.ts +12 -12
- package/src/platforms/slack/listener.test.ts +17 -17
- package/src/platforms/slack/token-extractor-node.test.ts +2 -2
- package/src/platforms/slack/token-extractor.test.ts +37 -37
- package/src/platforms/slack/types.test.ts +21 -21
- package/src/platforms/slackbot/client.test.ts +22 -22
- package/src/platforms/slackbot/commands/auth.test.ts +14 -14
- package/src/platforms/slackbot/commands/channel.test.ts +7 -7
- package/src/platforms/slackbot/commands/message.test.ts +13 -13
- package/src/platforms/slackbot/commands/reaction.test.ts +6 -6
- package/src/platforms/slackbot/commands/user.test.ts +7 -7
- package/src/platforms/slackbot/commands/whoami.test.ts +4 -4
- package/src/platforms/slackbot/credential-manager.test.ts +22 -22
- package/src/platforms/slackbot/types.test.ts +7 -7
- package/src/platforms/teams/client.test.ts +30 -30
- package/src/platforms/teams/commands/auth.test.ts +8 -8
- package/src/platforms/teams/commands/channel.test.ts +7 -7
- package/src/platforms/teams/commands/file.test.ts +4 -4
- package/src/platforms/teams/commands/message.test.ts +5 -5
- package/src/platforms/teams/commands/reaction.test.ts +4 -4
- package/src/platforms/teams/commands/snapshot.test.ts +7 -7
- package/src/platforms/teams/commands/team.test.ts +8 -8
- package/src/platforms/teams/commands/user.test.ts +4 -4
- package/src/platforms/teams/commands/whoami.test.ts +6 -6
- package/src/platforms/teams/credential-manager.test.ts +17 -17
- package/src/platforms/teams/ensure-auth.test.ts +13 -13
- package/src/platforms/teams/index.test.ts +15 -15
- package/src/platforms/teams/token-extractor.test.ts +219 -145
- package/src/platforms/teams/token-extractor.ts +13 -2
- package/src/platforms/teams/types.test.ts +26 -26
- package/src/platforms/telegram/app-config.test.ts +4 -4
- package/src/platforms/telegram/chat-utils.test.ts +12 -12
- package/src/platforms/telegram/client.test.ts +4 -4
- package/src/platforms/telegram/commands/auth.test.ts +16 -16
- package/src/platforms/telegram/commands/chat.test.ts +9 -9
- package/src/platforms/telegram/commands/message.test.ts +6 -6
- package/src/platforms/telegram/commands/shared.test.ts +3 -3
- package/src/platforms/telegram/commands/whoami.test.ts +3 -3
- package/src/platforms/telegram/credential-manager.test.ts +10 -10
- package/src/platforms/telegram/types.test.ts +6 -6
- package/src/platforms/webex/app-config.test.ts +8 -8
- package/src/platforms/webex/cli.test.ts +5 -5
- package/src/platforms/webex/client.test.ts +65 -65
- package/src/platforms/webex/commands/auth.test.ts +18 -18
- package/src/platforms/webex/commands/member.test.ts +5 -5
- package/src/platforms/webex/commands/message.test.ts +12 -12
- package/src/platforms/webex/commands/snapshot.test.ts +5 -5
- package/src/platforms/webex/commands/space.test.ts +10 -10
- package/src/platforms/webex/commands/whoami.test.ts +6 -6
- package/src/platforms/webex/credential-manager.test.ts +22 -22
- package/src/platforms/webex/encryption.test.ts +4 -4
- package/src/platforms/webex/ensure-auth.test.ts +5 -5
- package/src/platforms/webex/index.test.ts +5 -5
- package/src/platforms/webex/markdown-to-html.test.ts +33 -33
- package/src/platforms/webex/token-extractor.test.ts +23 -23
- package/src/platforms/webex/types.test.ts +27 -27
- package/src/platforms/wechatbot/client.test.ts +27 -27
- package/src/platforms/wechatbot/commands/auth.test.ts +15 -15
- package/src/platforms/wechatbot/commands/message.test.ts +8 -8
- package/src/platforms/wechatbot/commands/template.test.ts +9 -9
- package/src/platforms/wechatbot/commands/user.test.ts +7 -7
- package/src/platforms/wechatbot/commands/whoami.test.ts +5 -5
- package/src/platforms/wechatbot/credential-manager.test.ts +18 -18
- package/src/platforms/wechatbot/index.test.ts +10 -10
- package/src/platforms/wechatbot/types.test.ts +25 -25
- package/src/platforms/whatsapp/commands/auth.test.ts +13 -13
- package/src/platforms/whatsapp/commands/chat.test.ts +8 -8
- package/src/platforms/whatsapp/commands/message.test.ts +10 -10
- package/src/platforms/whatsapp/commands/whoami.test.ts +3 -3
- package/src/platforms/whatsapp/credential-manager.test.ts +23 -23
- package/src/platforms/whatsapp/ensure-auth.test.ts +4 -4
- package/src/platforms/whatsapp/index.test.ts +8 -8
- package/src/platforms/whatsapp/types.test.ts +42 -42
- package/src/platforms/whatsappbot/client.test.ts +27 -27
- package/src/platforms/whatsappbot/commands/auth.test.ts +14 -14
- package/src/platforms/whatsappbot/commands/message.test.ts +16 -16
- package/src/platforms/whatsappbot/commands/template.test.ts +9 -9
- package/src/platforms/whatsappbot/commands/whoami.test.ts +5 -5
- package/src/platforms/whatsappbot/credential-manager.test.ts +18 -18
- package/src/platforms/whatsappbot/index.test.ts +7 -7
- package/src/platforms/whatsappbot/types.test.ts +18 -18
- package/src/shared/chromium/browsers.test.ts +22 -22
- package/src/shared/chromium/cookie-reader.test.ts +13 -13
- package/src/shared/chromium/decryptor.test.ts +97 -32
- package/src/shared/chromium/decryptor.ts +27 -6
- package/src/shared/utils/concurrency.test.ts +6 -6
- package/src/shared/utils/derived-key-cache.test.ts +11 -11
- package/src/tui/utils.test.ts +31 -31
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect,
|
|
1
|
+
import { expect, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ChannelBotBotSchema,
|
|
@@ -17,58 +17,58 @@ import {
|
|
|
17
17
|
MessageBlockSchema,
|
|
18
18
|
} from '@/platforms/channeltalkbot/index'
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
it('ChannelBotClient is exported from barrel', () => {
|
|
21
21
|
expect(typeof ChannelBotClient).toBe('function')
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
it('ChannelBotError is exported from barrel', () => {
|
|
25
25
|
expect(typeof ChannelBotError).toBe('function')
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
it('ChannelBotCredentialManager is exported from barrel', () => {
|
|
29
29
|
expect(typeof ChannelBotCredentialManager).toBe('function')
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
it('ChannelBotBotSchema is exported from barrel', () => {
|
|
33
33
|
expect(typeof ChannelBotBotSchema.parse).toBe('function')
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
it('ChannelBotChannelSchema is exported from barrel', () => {
|
|
37
37
|
expect(typeof ChannelBotChannelSchema.parse).toBe('function')
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
it('ChannelBotConfigSchema is exported from barrel', () => {
|
|
41
41
|
expect(typeof ChannelBotConfigSchema.parse).toBe('function')
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
it('ChannelBotCredentialsSchema is exported from barrel', () => {
|
|
45
45
|
expect(typeof ChannelBotCredentialsSchema.parse).toBe('function')
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
it('ChannelBotGroupSchema is exported from barrel', () => {
|
|
49
49
|
expect(typeof ChannelBotGroupSchema.parse).toBe('function')
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
it('ChannelBotManagerSchema is exported from barrel', () => {
|
|
53
53
|
expect(typeof ChannelBotManagerSchema.parse).toBe('function')
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
it('ChannelBotMessageSchema is exported from barrel', () => {
|
|
57
57
|
expect(typeof ChannelBotMessageSchema.parse).toBe('function')
|
|
58
58
|
})
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
it('ChannelBotUserChatSchema is exported from barrel', () => {
|
|
61
61
|
expect(typeof ChannelBotUserChatSchema.parse).toBe('function')
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
it('ChannelBotUserSchema is exported from barrel', () => {
|
|
65
65
|
expect(typeof ChannelBotUserSchema.parse).toBe('function')
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
it('ChannelBotWorkspaceEntrySchema is exported from barrel', () => {
|
|
69
69
|
expect(typeof ChannelBotWorkspaceEntrySchema.parse).toBe('function')
|
|
70
70
|
})
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
it('MessageBlockSchema is exported from barrel', () => {
|
|
73
73
|
expect(typeof MessageBlockSchema.parse).toBe('function')
|
|
74
74
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { DiscordClient, DiscordError } from './client'
|
|
4
4
|
|
|
@@ -48,19 +48,19 @@ describe('DiscordClient', () => {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
describe('constructor', () => {
|
|
51
|
-
|
|
51
|
+
it('requires token', async () => {
|
|
52
52
|
await expect(new DiscordClient().login({ token: '' })).rejects.toThrow(DiscordError)
|
|
53
53
|
await expect(new DiscordClient().login({ token: '' })).rejects.toThrow('Token is required')
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
it('accepts valid token', async () => {
|
|
57
57
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
58
58
|
expect(client).toBeInstanceOf(DiscordClient)
|
|
59
59
|
})
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
describe('testAuth', () => {
|
|
63
|
-
|
|
63
|
+
it('returns current user info', async () => {
|
|
64
64
|
mockResponse({
|
|
65
65
|
id: '123456789',
|
|
66
66
|
username: 'testuser',
|
|
@@ -80,7 +80,7 @@ describe('DiscordClient', () => {
|
|
|
80
80
|
})
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
it('throws DiscordError on API error', async () => {
|
|
84
84
|
mockResponse({ message: 'Unauthorized', code: 401 }, 401)
|
|
85
85
|
|
|
86
86
|
const client = await new DiscordClient().login({ token: 'bad-token' })
|
|
@@ -89,7 +89,7 @@ describe('DiscordClient', () => {
|
|
|
89
89
|
})
|
|
90
90
|
|
|
91
91
|
describe('listServers', () => {
|
|
92
|
-
|
|
92
|
+
it('returns list of servers', async () => {
|
|
93
93
|
mockResponse([
|
|
94
94
|
{ id: '111', name: 'Server One' },
|
|
95
95
|
{ id: '222', name: 'Server Two' },
|
|
@@ -105,7 +105,7 @@ describe('DiscordClient', () => {
|
|
|
105
105
|
})
|
|
106
106
|
|
|
107
107
|
describe('getServer', () => {
|
|
108
|
-
|
|
108
|
+
it('returns server info', async () => {
|
|
109
109
|
mockResponse({ id: '111', name: 'Test Server' })
|
|
110
110
|
|
|
111
111
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -118,7 +118,7 @@ describe('DiscordClient', () => {
|
|
|
118
118
|
})
|
|
119
119
|
|
|
120
120
|
describe('listChannels', () => {
|
|
121
|
-
|
|
121
|
+
it('returns list of channels for server', async () => {
|
|
122
122
|
mockResponse([
|
|
123
123
|
{ id: 'ch1', guild_id: '111', name: 'general', type: 0 },
|
|
124
124
|
{ id: 'ch2', guild_id: '111', name: 'random', type: 0 },
|
|
@@ -134,7 +134,7 @@ describe('DiscordClient', () => {
|
|
|
134
134
|
})
|
|
135
135
|
|
|
136
136
|
describe('getChannel', () => {
|
|
137
|
-
|
|
137
|
+
it('returns channel info', async () => {
|
|
138
138
|
mockResponse({ id: 'ch1', guild_id: '111', name: 'general', type: 0 })
|
|
139
139
|
|
|
140
140
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -147,7 +147,7 @@ describe('DiscordClient', () => {
|
|
|
147
147
|
})
|
|
148
148
|
|
|
149
149
|
describe('sendMessage', () => {
|
|
150
|
-
|
|
150
|
+
it('sends message to channel', async () => {
|
|
151
151
|
mockResponse({
|
|
152
152
|
id: 'msg1',
|
|
153
153
|
channel_id: 'ch1',
|
|
@@ -167,7 +167,7 @@ describe('DiscordClient', () => {
|
|
|
167
167
|
})
|
|
168
168
|
|
|
169
169
|
describe('getMessages', () => {
|
|
170
|
-
|
|
170
|
+
it('returns messages from channel', async () => {
|
|
171
171
|
mockResponse([
|
|
172
172
|
{
|
|
173
173
|
id: 'msg1',
|
|
@@ -186,7 +186,7 @@ describe('DiscordClient', () => {
|
|
|
186
186
|
expect(fetchCalls[0].url).toBe('https://discord.com/api/v10/channels/ch1/messages?limit=50')
|
|
187
187
|
})
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
it('uses default limit of 50', async () => {
|
|
190
190
|
mockResponse([])
|
|
191
191
|
|
|
192
192
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -197,7 +197,7 @@ describe('DiscordClient', () => {
|
|
|
197
197
|
})
|
|
198
198
|
|
|
199
199
|
describe('getMessage', () => {
|
|
200
|
-
|
|
200
|
+
it('returns single message', async () => {
|
|
201
201
|
mockResponse({
|
|
202
202
|
id: 'msg1',
|
|
203
203
|
channel_id: 'ch1',
|
|
@@ -215,7 +215,7 @@ describe('DiscordClient', () => {
|
|
|
215
215
|
})
|
|
216
216
|
|
|
217
217
|
describe('deleteMessage', () => {
|
|
218
|
-
|
|
218
|
+
it('deletes message', async () => {
|
|
219
219
|
mockResponse(null, 204)
|
|
220
220
|
|
|
221
221
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -227,7 +227,7 @@ describe('DiscordClient', () => {
|
|
|
227
227
|
})
|
|
228
228
|
|
|
229
229
|
describe('addReaction', () => {
|
|
230
|
-
|
|
230
|
+
it('adds reaction to message', async () => {
|
|
231
231
|
mockResponse(null, 204)
|
|
232
232
|
|
|
233
233
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -241,7 +241,7 @@ describe('DiscordClient', () => {
|
|
|
241
241
|
})
|
|
242
242
|
|
|
243
243
|
describe('removeReaction', () => {
|
|
244
|
-
|
|
244
|
+
it('removes reaction from message', async () => {
|
|
245
245
|
mockResponse(null, 204)
|
|
246
246
|
|
|
247
247
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -255,7 +255,7 @@ describe('DiscordClient', () => {
|
|
|
255
255
|
})
|
|
256
256
|
|
|
257
257
|
describe('listUsers', () => {
|
|
258
|
-
|
|
258
|
+
it('returns list of server members', async () => {
|
|
259
259
|
mockResponse([{ user: { id: 'u1', username: 'user1' } }, { user: { id: 'u2', username: 'user2' } }])
|
|
260
260
|
|
|
261
261
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -268,7 +268,7 @@ describe('DiscordClient', () => {
|
|
|
268
268
|
})
|
|
269
269
|
|
|
270
270
|
describe('getUser', () => {
|
|
271
|
-
|
|
271
|
+
it('returns user info', async () => {
|
|
272
272
|
mockResponse({ id: 'u1', username: 'testuser' })
|
|
273
273
|
|
|
274
274
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -281,7 +281,7 @@ describe('DiscordClient', () => {
|
|
|
281
281
|
})
|
|
282
282
|
|
|
283
283
|
describe('uploadFile', () => {
|
|
284
|
-
|
|
284
|
+
it('uploads file to channel', async () => {
|
|
285
285
|
const tempFile = '/tmp/test-upload.txt'
|
|
286
286
|
await Bun.write(tempFile, 'test content')
|
|
287
287
|
|
|
@@ -311,7 +311,7 @@ describe('DiscordClient', () => {
|
|
|
311
311
|
})
|
|
312
312
|
|
|
313
313
|
describe('listFiles', () => {
|
|
314
|
-
|
|
314
|
+
it('returns files from recent messages', async () => {
|
|
315
315
|
mockResponse([
|
|
316
316
|
{
|
|
317
317
|
id: 'msg1',
|
|
@@ -340,7 +340,7 @@ describe('DiscordClient', () => {
|
|
|
340
340
|
})
|
|
341
341
|
|
|
342
342
|
describe('rate limiting', () => {
|
|
343
|
-
|
|
343
|
+
it('waits when bucket is exhausted before making request', async () => {
|
|
344
344
|
mockResponse({ id: '1', username: 'user1' }, 200, {
|
|
345
345
|
'X-RateLimit-Remaining': '0',
|
|
346
346
|
'X-RateLimit-Reset': String(Date.now() / 1000 + 0.1),
|
|
@@ -363,7 +363,7 @@ describe('DiscordClient', () => {
|
|
|
363
363
|
expect(fetchCalls.length).toBe(2)
|
|
364
364
|
})
|
|
365
365
|
|
|
366
|
-
|
|
366
|
+
it('retries on 429 with Retry-After header', async () => {
|
|
367
367
|
mockResponse({ message: 'Rate limited', retry_after: 0.1 }, 429, { 'Retry-After': '0.1' })
|
|
368
368
|
mockResponse({ id: '123', username: 'user' })
|
|
369
369
|
|
|
@@ -374,7 +374,7 @@ describe('DiscordClient', () => {
|
|
|
374
374
|
expect(fetchCalls.length).toBe(2)
|
|
375
375
|
})
|
|
376
376
|
|
|
377
|
-
|
|
377
|
+
it('handles global rate limit', async () => {
|
|
378
378
|
mockResponse({ message: 'Global rate limited', global: true }, 429, {
|
|
379
379
|
'Retry-After': '0.1',
|
|
380
380
|
'X-RateLimit-Global': 'true',
|
|
@@ -388,7 +388,7 @@ describe('DiscordClient', () => {
|
|
|
388
388
|
expect(fetchCalls.length).toBe(2)
|
|
389
389
|
})
|
|
390
390
|
|
|
391
|
-
|
|
391
|
+
it('throws after max retries exceeded', async () => {
|
|
392
392
|
for (let i = 0; i <= 3; i++) {
|
|
393
393
|
mockResponse({ message: 'Rate limited' }, 429, { 'Retry-After': '0.01' })
|
|
394
394
|
}
|
|
@@ -400,7 +400,7 @@ describe('DiscordClient', () => {
|
|
|
400
400
|
})
|
|
401
401
|
|
|
402
402
|
describe('retry logic', () => {
|
|
403
|
-
|
|
403
|
+
it('retries on 500 server error', async () => {
|
|
404
404
|
mockResponse({ message: 'Internal Server Error' }, 500)
|
|
405
405
|
mockResponse({ id: '123', username: 'user' })
|
|
406
406
|
|
|
@@ -411,7 +411,7 @@ describe('DiscordClient', () => {
|
|
|
411
411
|
expect(fetchCalls.length).toBe(2)
|
|
412
412
|
})
|
|
413
413
|
|
|
414
|
-
|
|
414
|
+
it('does not retry on 4xx client errors (except 429)', async () => {
|
|
415
415
|
mockResponse({ message: 'Not Found' }, 404)
|
|
416
416
|
|
|
417
417
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
@@ -419,7 +419,7 @@ describe('DiscordClient', () => {
|
|
|
419
419
|
expect(fetchCalls.length).toBe(1)
|
|
420
420
|
})
|
|
421
421
|
|
|
422
|
-
|
|
422
|
+
it('exponential backoff increases delay', async () => {
|
|
423
423
|
mockResponse({ message: 'Error' }, 500)
|
|
424
424
|
mockResponse({ message: 'Error' }, 500)
|
|
425
425
|
mockResponse({ id: '123', username: 'user' })
|
|
@@ -435,7 +435,7 @@ describe('DiscordClient', () => {
|
|
|
435
435
|
})
|
|
436
436
|
|
|
437
437
|
describe('bucket key normalization', () => {
|
|
438
|
-
|
|
438
|
+
it('normalizes channel IDs in routes', async () => {
|
|
439
439
|
mockResponse([])
|
|
440
440
|
mockResponse([])
|
|
441
441
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, expect, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, expect, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { DiscordClient } from '../client'
|
|
4
4
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
@@ -52,40 +52,40 @@ afterEach(() => {
|
|
|
52
52
|
credManagerClearTokenSpy?.mockRestore()
|
|
53
53
|
})
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
it('extract: calls DiscordTokenExtractor', async () => {
|
|
56
56
|
const extractor = new DiscordTokenExtractor()
|
|
57
57
|
const result = await extractor.extract()
|
|
58
58
|
expect(result).toBeDefined()
|
|
59
59
|
expect(result[0]?.token).toBe('test-token-123')
|
|
60
60
|
})
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
it('extract: validates token with DiscordClient', async () => {
|
|
63
63
|
const client = await new DiscordClient().login({ token: 'test-token-123' })
|
|
64
64
|
const authInfo = await client.testAuth()
|
|
65
65
|
expect(authInfo).toBeDefined()
|
|
66
66
|
expect(authInfo.id).toBe('user-123')
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
it('extract: discovers servers', async () => {
|
|
70
70
|
const client = await new DiscordClient().login({ token: 'test-token-123' })
|
|
71
71
|
const servers = await client.listServers()
|
|
72
72
|
expect(servers).toHaveLength(2)
|
|
73
73
|
expect(servers[0].id).toBe('server-1')
|
|
74
74
|
})
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
it('logout: clears credentials', async () => {
|
|
77
77
|
const credManager = new DiscordCredentialManager()
|
|
78
78
|
await credManager.clearToken()
|
|
79
79
|
expect(credManager.clearToken).toHaveBeenCalled()
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
it('status: returns auth state', async () => {
|
|
83
83
|
const credManager = new DiscordCredentialManager()
|
|
84
84
|
const config = await credManager.load()
|
|
85
85
|
expect(config.token).toBeNull()
|
|
86
86
|
expect(config.current_server).toBeNull()
|
|
87
87
|
})
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
it('no-token message mentions desktop app and browser fallback', () => {
|
|
90
90
|
expect(getNoDiscordTokenFoundMessage()).toContain('desktop app or a supported Chromium browser')
|
|
91
91
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, expect, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, expect, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { DiscordClient } from '../client'
|
|
4
4
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
@@ -72,7 +72,7 @@ afterEach(() => {
|
|
|
72
72
|
credManagerLoadSpy?.mockRestore()
|
|
73
73
|
})
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
it('list: returns text channels (type=0) from server', async () => {
|
|
76
76
|
// given: discord client with channels
|
|
77
77
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
78
78
|
const channels = await client.listChannels('server-1')
|
|
@@ -86,7 +86,7 @@ test('list: returns text channels (type=0) from server', async () => {
|
|
|
86
86
|
expect(textChannels[1].name).toBe('announcements')
|
|
87
87
|
})
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
it('list: includes channel metadata', async () => {
|
|
90
90
|
// given: discord client with channels
|
|
91
91
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
92
92
|
const channels = await client.listChannels('server-1')
|
|
@@ -102,7 +102,7 @@ test('list: includes channel metadata', async () => {
|
|
|
102
102
|
expect(channel.topic).toBeDefined()
|
|
103
103
|
})
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
it('info: returns channel details', async () => {
|
|
106
106
|
// given: discord client with channel data
|
|
107
107
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
108
108
|
const channel = await client.getChannel('ch-1')
|
|
@@ -117,7 +117,7 @@ test('info: returns channel details', async () => {
|
|
|
117
117
|
expect(channel.topic).toBe('General discussion')
|
|
118
118
|
})
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
it('info: throws error for non-existent channel', async () => {
|
|
121
121
|
// given: discord client
|
|
122
122
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
123
123
|
|
|
@@ -131,7 +131,7 @@ test('info: throws error for non-existent channel', async () => {
|
|
|
131
131
|
}
|
|
132
132
|
})
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
it('history: returns messages in reverse chronological order', async () => {
|
|
135
135
|
// given: discord client with messages
|
|
136
136
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
137
137
|
const messages = await client.getMessages('ch-1', 50)
|
|
@@ -147,7 +147,7 @@ test('history: returns messages in reverse chronological order', async () => {
|
|
|
147
147
|
expect(messages[1].author.username).toBe('bob')
|
|
148
148
|
})
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
it('history: includes message metadata', async () => {
|
|
151
151
|
// given: discord client with messages
|
|
152
152
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
153
153
|
const messages = await client.getMessages('ch-1', 50)
|
|
@@ -66,7 +66,7 @@ afterEach(() => {
|
|
|
66
66
|
|
|
67
67
|
describe('dm commands', () => {
|
|
68
68
|
describe('listAction', () => {
|
|
69
|
-
it('
|
|
69
|
+
it('lists DM channels', async () => {
|
|
70
70
|
const consoleSpy = mock(() => {})
|
|
71
71
|
const originalLog = console.log
|
|
72
72
|
console.log = consoleSpy
|
|
@@ -79,7 +79,7 @@ describe('dm commands', () => {
|
|
|
79
79
|
expect(clientListDMChannelsSpy).toHaveBeenCalled()
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
-
it('
|
|
82
|
+
it('handles authentication error', async () => {
|
|
83
83
|
credManagerLoadSpy.mockResolvedValue({
|
|
84
84
|
token: '',
|
|
85
85
|
current_server: null,
|
|
@@ -105,7 +105,7 @@ describe('dm commands', () => {
|
|
|
105
105
|
})
|
|
106
106
|
|
|
107
107
|
describe('createAction', () => {
|
|
108
|
-
it('
|
|
108
|
+
it('creates a DM channel', async () => {
|
|
109
109
|
const consoleSpy = mock(() => {})
|
|
110
110
|
const originalLog = console.log
|
|
111
111
|
console.log = consoleSpy
|
|
@@ -118,7 +118,7 @@ describe('dm commands', () => {
|
|
|
118
118
|
expect(clientCreateDMSpy).toHaveBeenCalledWith('456')
|
|
119
119
|
})
|
|
120
120
|
|
|
121
|
-
it('
|
|
121
|
+
it('handles authentication error', async () => {
|
|
122
122
|
credManagerLoadSpy.mockResolvedValue({
|
|
123
123
|
token: '',
|
|
124
124
|
current_server: null,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, expect, mock, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, expect, mock, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { DiscordClient } from '../client'
|
|
4
4
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
@@ -49,7 +49,7 @@ afterEach(() => {
|
|
|
49
49
|
credManagerLoadSpy?.mockRestore()
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
it('upload: sends multipart request and returns file info', async () => {
|
|
53
53
|
const consoleSpy = mock((_msg: string) => {})
|
|
54
54
|
console.log = consoleSpy
|
|
55
55
|
|
|
@@ -61,7 +61,7 @@ test('upload: sends multipart request and returns file info', async () => {
|
|
|
61
61
|
expect(output).toContain('test.pdf')
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
it('list: filters messages with attachments', async () => {
|
|
65
65
|
const consoleSpy = mock((_msg: string) => {})
|
|
66
66
|
console.log = consoleSpy
|
|
67
67
|
|
|
@@ -73,7 +73,7 @@ test('list: filters messages with attachments', async () => {
|
|
|
73
73
|
expect(output).toContain('file_124')
|
|
74
74
|
})
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
it('info: returns single file details', async () => {
|
|
77
77
|
const consoleSpy = mock((_msg: string) => {})
|
|
78
78
|
console.log = consoleSpy
|
|
79
79
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, expect, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, expect, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { DiscordClient } from '../client'
|
|
4
4
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
@@ -62,7 +62,7 @@ afterEach(() => {
|
|
|
62
62
|
credManagerLoadSpy?.mockRestore()
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
it('list: returns all relationships', async () => {
|
|
66
66
|
// given: discord client with relationships
|
|
67
67
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
68
68
|
const relationships = await client.getRelationships()
|
|
@@ -74,7 +74,7 @@ test('list: returns all relationships', async () => {
|
|
|
74
74
|
expect(relationships).toHaveLength(4)
|
|
75
75
|
})
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
it('list: includes relationship metadata', async () => {
|
|
78
78
|
// given: discord client with relationships
|
|
79
79
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
80
80
|
const relationships = await client.getRelationships()
|
|
@@ -90,7 +90,7 @@ test('list: includes relationship metadata', async () => {
|
|
|
90
90
|
expect(relationship.user.username).toBeDefined()
|
|
91
91
|
})
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
it('list: filters friends (type=1)', async () => {
|
|
94
94
|
// given: discord client with relationships
|
|
95
95
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
96
96
|
const relationships = await client.getRelationships()
|
|
@@ -104,7 +104,7 @@ test('list: filters friends (type=1)', async () => {
|
|
|
104
104
|
expect(friends[1].user.username).toBe('bob')
|
|
105
105
|
})
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
it('list: includes optional nickname', async () => {
|
|
108
108
|
// given: discord client with relationships
|
|
109
109
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
110
110
|
const relationships = await client.getRelationships()
|
|
@@ -118,7 +118,7 @@ test('list: includes optional nickname', async () => {
|
|
|
118
118
|
expect(withoutNickname?.nickname).toBeUndefined()
|
|
119
119
|
})
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
it('list: distinguishes relationship types', async () => {
|
|
122
122
|
// given: discord client with relationships
|
|
123
123
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
124
124
|
const relationships = await client.getRelationships()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, expect, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, expect, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { DiscordClient } from '../client'
|
|
4
4
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
@@ -54,7 +54,7 @@ afterEach(() => {
|
|
|
54
54
|
credManagerLoadSpy?.mockRestore()
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
it('search: returns members matching query', async () => {
|
|
58
58
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
59
59
|
const members = await client.searchMembers('guild-1', 'alice', 10)
|
|
60
60
|
|
|
@@ -64,7 +64,7 @@ test('search: returns members matching query', async () => {
|
|
|
64
64
|
expect(members[1].user.username).toBe('alice_bot')
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
it('search: includes member metadata', async () => {
|
|
68
68
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
69
69
|
const members = await client.searchMembers('guild-1', 'alice', 10)
|
|
70
70
|
|
|
@@ -82,7 +82,7 @@ test('search: includes member metadata', async () => {
|
|
|
82
82
|
expect(member.flags).toBe(0)
|
|
83
83
|
})
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
it('search: respects limit parameter', async () => {
|
|
86
86
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
87
87
|
|
|
88
88
|
await client.searchMembers('guild-1', 'alice', 5)
|
|
@@ -90,7 +90,7 @@ test('search: respects limit parameter', async () => {
|
|
|
90
90
|
expect(clientSearchMembersSpy).toHaveBeenCalledWith('guild-1', 'alice', 5)
|
|
91
91
|
})
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
it('search: uses default limit of 10', async () => {
|
|
94
94
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
95
95
|
|
|
96
96
|
const members = await client.searchMembers('guild-1', 'alice')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, expect, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, expect, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { DiscordClient } from '../client'
|
|
4
4
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
@@ -46,7 +46,7 @@ afterEach(() => {
|
|
|
46
46
|
credManagerLoadSpy?.mockRestore()
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
it('getMentions: returns mentions', async () => {
|
|
50
50
|
// given: discord client
|
|
51
51
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
52
52
|
|
|
@@ -62,7 +62,7 @@ test('getMentions: returns mentions', async () => {
|
|
|
62
62
|
expect(mentions[1].mention_everyone).toBe(true)
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
it('getMentions: respects limit option', async () => {
|
|
66
66
|
// given: discord client with limit option
|
|
67
67
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
68
68
|
clientGetMentionsSpy.mockResolvedValue([
|
|
@@ -85,7 +85,7 @@ test('getMentions: respects limit option', async () => {
|
|
|
85
85
|
expect(clientGetMentionsSpy).toHaveBeenCalledWith({ limit: 1 })
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
it('getMentions: respects guildId option', async () => {
|
|
89
89
|
// given: discord client with guildId option
|
|
90
90
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
91
91
|
clientGetMentionsSpy.mockResolvedValue([
|
|
@@ -110,7 +110,7 @@ test('getMentions: respects guildId option', async () => {
|
|
|
110
110
|
expect(clientGetMentionsSpy).toHaveBeenCalledWith({ guildId: 'guild-1' })
|
|
111
111
|
})
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
it('getMentions: includes mention metadata', async () => {
|
|
114
114
|
// given: discord client with mentions
|
|
115
115
|
const client = await new DiscordClient().login({ token: 'test-token' })
|
|
116
116
|
const mentions = await client.getMentions()
|