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 { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { SlackClient } from '@/platforms/slack/client'
|
|
4
4
|
|
|
@@ -17,14 +17,14 @@ describe('Emoji Commands', () => {
|
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
describe('emoji list', () => {
|
|
20
|
-
|
|
20
|
+
it('lists custom emoji', async () => {
|
|
21
21
|
const emoji = await (mockClient as SlackClient).listEmoji()
|
|
22
22
|
expect(emoji['party_blob']).toBe('https://example.com/party_blob.gif')
|
|
23
23
|
expect(emoji['cool_sunglasses']).toBe('https://example.com/cool_sunglasses.png')
|
|
24
24
|
expect(Object.keys(emoji)).toHaveLength(2)
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
it('throws error when API fails', async () => {
|
|
28
28
|
mockClient.listEmoji = mock(async () => {
|
|
29
29
|
throw new Error('invalid_auth')
|
|
30
30
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { SlackClient } from '@/platforms/slack/client'
|
|
4
4
|
import type { SlackFile } from '@/platforms/slack/types'
|
|
@@ -72,7 +72,7 @@ describe('File Commands', () => {
|
|
|
72
72
|
})
|
|
73
73
|
|
|
74
74
|
describe('file upload', () => {
|
|
75
|
-
|
|
75
|
+
it('uploads file to channel', async () => {
|
|
76
76
|
const channel = 'C123'
|
|
77
77
|
const fileBuffer = Buffer.from('test content')
|
|
78
78
|
const filename = 'test.txt'
|
|
@@ -85,7 +85,7 @@ describe('File Commands', () => {
|
|
|
85
85
|
expect(result.channels).toContain(channel)
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
it('supports --filename override', async () => {
|
|
89
89
|
const channel = 'C123'
|
|
90
90
|
const fileBuffer = Buffer.from('content')
|
|
91
91
|
const customFilename = 'custom-name.txt'
|
|
@@ -95,7 +95,7 @@ describe('File Commands', () => {
|
|
|
95
95
|
expect(result.name).toBe(customFilename)
|
|
96
96
|
})
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
it('returns file with metadata', () => {
|
|
99
99
|
const file: SlackFile = {
|
|
100
100
|
id: 'F123',
|
|
101
101
|
name: 'test.txt',
|
|
@@ -115,7 +115,7 @@ describe('File Commands', () => {
|
|
|
115
115
|
})
|
|
116
116
|
|
|
117
117
|
describe('file list', () => {
|
|
118
|
-
|
|
118
|
+
it('lists all files in workspace', async () => {
|
|
119
119
|
const files = await mockClient.listFiles()
|
|
120
120
|
|
|
121
121
|
expect(files).toHaveLength(2)
|
|
@@ -123,7 +123,7 @@ describe('File Commands', () => {
|
|
|
123
123
|
expect(files[1].name).toBe('document.pdf')
|
|
124
124
|
})
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
it('filters files by channel', async () => {
|
|
127
127
|
const channel = 'C123'
|
|
128
128
|
|
|
129
129
|
const files = await mockClient.listFiles(channel)
|
|
@@ -132,7 +132,7 @@ describe('File Commands', () => {
|
|
|
132
132
|
expect(files.length).toBeGreaterThan(0)
|
|
133
133
|
})
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
it('returns files with metadata', () => {
|
|
136
136
|
const files: SlackFile[] = [
|
|
137
137
|
{
|
|
138
138
|
id: 'F123',
|
|
@@ -165,7 +165,7 @@ describe('File Commands', () => {
|
|
|
165
165
|
})
|
|
166
166
|
|
|
167
167
|
describe('file info', () => {
|
|
168
|
-
|
|
168
|
+
it('shows file details', async () => {
|
|
169
169
|
const fileId = 'F123'
|
|
170
170
|
|
|
171
171
|
const files = await mockClient.listFiles()
|
|
@@ -178,7 +178,7 @@ describe('File Commands', () => {
|
|
|
178
178
|
})
|
|
179
179
|
|
|
180
180
|
describe('file download', () => {
|
|
181
|
-
|
|
181
|
+
it('downloads file by ID', async () => {
|
|
182
182
|
const fileId = 'F123'
|
|
183
183
|
const result = await mockClient.downloadFile(fileId)
|
|
184
184
|
|
|
@@ -187,7 +187,7 @@ describe('File Commands', () => {
|
|
|
187
187
|
expect(result.buffer.toString()).toBe('downloaded content')
|
|
188
188
|
})
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
it('sanitizes filename to prevent path traversal', () => {
|
|
191
191
|
const { basename } = require('node:path')
|
|
192
192
|
const sanitize = (name: string) => basename(name.replace(/\\/g, '/'))
|
|
193
193
|
|
|
@@ -199,7 +199,7 @@ describe('File Commands', () => {
|
|
|
199
199
|
})
|
|
200
200
|
|
|
201
201
|
describe('output formatting', () => {
|
|
202
|
-
|
|
202
|
+
it('includes file fields in output', () => {
|
|
203
203
|
const file: SlackFile = {
|
|
204
204
|
id: 'F123',
|
|
205
205
|
name: 'test.txt',
|
|
@@ -217,7 +217,7 @@ describe('File Commands', () => {
|
|
|
217
217
|
expect(output.name).toBe('test.txt')
|
|
218
218
|
})
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
it('formats multiple files', () => {
|
|
221
221
|
const files: SlackFile[] = [
|
|
222
222
|
{
|
|
223
223
|
id: 'F123',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { SlackClient } from '@/platforms/slack/client'
|
|
4
4
|
import type { SlackMessage } from '@/platforms/slack/types'
|
|
@@ -97,7 +97,7 @@ describe('Message Commands', () => {
|
|
|
97
97
|
})
|
|
98
98
|
|
|
99
99
|
describe('message send', () => {
|
|
100
|
-
|
|
100
|
+
it('sends message to channel', async () => {
|
|
101
101
|
// Given: A channel and message text
|
|
102
102
|
const channel = 'C123'
|
|
103
103
|
const text = 'Hello, world!'
|
|
@@ -111,7 +111,7 @@ describe('Message Commands', () => {
|
|
|
111
111
|
expect(result.type).toBe('message')
|
|
112
112
|
})
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
it('sends message to thread', async () => {
|
|
115
115
|
// Given: A channel, message text, and thread ts
|
|
116
116
|
const channel = 'C123'
|
|
117
117
|
const text = 'Reply in thread'
|
|
@@ -127,7 +127,7 @@ describe('Message Commands', () => {
|
|
|
127
127
|
})
|
|
128
128
|
|
|
129
129
|
describe('message list', () => {
|
|
130
|
-
|
|
130
|
+
it('lists messages from channel', async () => {
|
|
131
131
|
// Given: A channel
|
|
132
132
|
const channel = 'C123'
|
|
133
133
|
|
|
@@ -140,7 +140,7 @@ describe('Message Commands', () => {
|
|
|
140
140
|
expect(messages[1].text).toBe('Second message')
|
|
141
141
|
})
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
it('respects limit parameter', async () => {
|
|
144
144
|
// Given: A channel and limit
|
|
145
145
|
const channel = 'C123'
|
|
146
146
|
const limit = 10
|
|
@@ -152,7 +152,7 @@ describe('Message Commands', () => {
|
|
|
152
152
|
expect(messages).toBeDefined()
|
|
153
153
|
})
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
it('filters messages by thread', async () => {
|
|
156
156
|
// Given: A channel and thread ts
|
|
157
157
|
const channel = 'C123'
|
|
158
158
|
const _threadTs = '1234567890.123456'
|
|
@@ -166,7 +166,7 @@ describe('Message Commands', () => {
|
|
|
166
166
|
})
|
|
167
167
|
|
|
168
168
|
describe('message update', () => {
|
|
169
|
-
|
|
169
|
+
it('updates message text', async () => {
|
|
170
170
|
// Given: A channel, message ts, and new text
|
|
171
171
|
const channel = 'C123'
|
|
172
172
|
const ts = '1234567890.123456'
|
|
@@ -182,7 +182,7 @@ describe('Message Commands', () => {
|
|
|
182
182
|
})
|
|
183
183
|
|
|
184
184
|
describe('message delete', () => {
|
|
185
|
-
|
|
185
|
+
it('deletes message', async () => {
|
|
186
186
|
// Given: A channel and message ts
|
|
187
187
|
const channel = 'C123'
|
|
188
188
|
const ts = '1234567890.123456'
|
|
@@ -196,7 +196,7 @@ describe('Message Commands', () => {
|
|
|
196
196
|
})
|
|
197
197
|
|
|
198
198
|
describe('message get', () => {
|
|
199
|
-
|
|
199
|
+
it('gets single message by timestamp', async () => {
|
|
200
200
|
// Given: A channel and message ts
|
|
201
201
|
const channel = 'C123'
|
|
202
202
|
const ts = '1234567890.123456'
|
|
@@ -210,7 +210,7 @@ describe('Message Commands', () => {
|
|
|
210
210
|
expect(message?.text).toBe('Found single message')
|
|
211
211
|
})
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
it('returns null for non-existent message', async () => {
|
|
214
214
|
// Given: A channel and non-existent ts
|
|
215
215
|
const channel = 'C123'
|
|
216
216
|
const ts = '9999999999.999999'
|
|
@@ -224,7 +224,7 @@ describe('Message Commands', () => {
|
|
|
224
224
|
})
|
|
225
225
|
|
|
226
226
|
describe('message search', () => {
|
|
227
|
-
|
|
227
|
+
it('searches messages across workspace', async () => {
|
|
228
228
|
// Given: A search query
|
|
229
229
|
const query = 'hello world'
|
|
230
230
|
|
|
@@ -238,7 +238,7 @@ describe('Message Commands', () => {
|
|
|
238
238
|
expect(results[0].permalink).toBeDefined()
|
|
239
239
|
})
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
it('returns channel info with each result', async () => {
|
|
242
242
|
// Given: A search query
|
|
243
243
|
const query = 'test'
|
|
244
244
|
|
|
@@ -255,7 +255,7 @@ describe('Message Commands', () => {
|
|
|
255
255
|
})
|
|
256
256
|
|
|
257
257
|
describe('message replies', () => {
|
|
258
|
-
|
|
258
|
+
it('gets thread replies including parent message', async () => {
|
|
259
259
|
// Given: A channel and thread ts
|
|
260
260
|
const channel = 'C123'
|
|
261
261
|
const threadTs = '1234567890.123456'
|
|
@@ -271,7 +271,7 @@ describe('Message Commands', () => {
|
|
|
271
271
|
expect(result.messages[2].text).toBe('Second reply')
|
|
272
272
|
})
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
it('returns has_more flag for pagination', async () => {
|
|
275
275
|
// Given: A channel and thread ts
|
|
276
276
|
const channel = 'C123'
|
|
277
277
|
const threadTs = '1234567890.123456'
|
|
@@ -283,7 +283,7 @@ describe('Message Commands', () => {
|
|
|
283
283
|
expect(result.has_more).toBe(false)
|
|
284
284
|
})
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
it('all replies have same thread_ts as parent', async () => {
|
|
287
287
|
// Given: A channel and thread ts
|
|
288
288
|
const channel = 'C123'
|
|
289
289
|
const threadTs = '1234567890.123456'
|
|
@@ -299,7 +299,7 @@ describe('Message Commands', () => {
|
|
|
299
299
|
})
|
|
300
300
|
|
|
301
301
|
describe('output formatting', () => {
|
|
302
|
-
|
|
302
|
+
it('formats message output', () => {
|
|
303
303
|
// Given: A message
|
|
304
304
|
const message: SlackMessage = {
|
|
305
305
|
ts: '1234567890.123456',
|
|
@@ -316,7 +316,7 @@ describe('Message Commands', () => {
|
|
|
316
316
|
expect(output.text).toBe('Hello')
|
|
317
317
|
})
|
|
318
318
|
|
|
319
|
-
|
|
319
|
+
it('formats multiple messages', () => {
|
|
320
320
|
// Given: Multiple messages
|
|
321
321
|
const messages: SlackMessage[] = [
|
|
322
322
|
{
|
|
@@ -342,7 +342,7 @@ describe('Message Commands', () => {
|
|
|
342
342
|
expect(output[1].text).toBe('Second')
|
|
343
343
|
})
|
|
344
344
|
|
|
345
|
-
|
|
345
|
+
it('formats message with files', () => {
|
|
346
346
|
// Given: A message with file attachments
|
|
347
347
|
const message: SlackMessage = {
|
|
348
348
|
ts: '1234567890.123456',
|
|
@@ -375,7 +375,7 @@ describe('Message Commands', () => {
|
|
|
375
375
|
expect(output.files![0].url_private).toContain('files.slack.com')
|
|
376
376
|
})
|
|
377
377
|
|
|
378
|
-
|
|
378
|
+
it('message without files has undefined files field', () => {
|
|
379
379
|
// Given: A message without file attachments
|
|
380
380
|
const message: SlackMessage = {
|
|
381
381
|
ts: '1234567890.123456',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { SlackClient } from '@/platforms/slack/client'
|
|
4
4
|
import type { SlackPin } from '@/platforms/slack/types'
|
|
@@ -29,12 +29,12 @@ describe('Pin Commands', () => {
|
|
|
29
29
|
})
|
|
30
30
|
|
|
31
31
|
describe('pin add', () => {
|
|
32
|
-
|
|
32
|
+
it('pins a message successfully', async () => {
|
|
33
33
|
await (mockClient as SlackClient).pinMessage('C001', '1234567890.123456')
|
|
34
34
|
expect(mockClient.pinMessage).toHaveBeenCalledWith('C001', '1234567890.123456')
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
it('throws error when API fails', async () => {
|
|
38
38
|
mockClient.pinMessage = mock(async () => {
|
|
39
39
|
throw new Error('already_pinned')
|
|
40
40
|
})
|
|
@@ -43,12 +43,12 @@ describe('Pin Commands', () => {
|
|
|
43
43
|
})
|
|
44
44
|
|
|
45
45
|
describe('pin remove', () => {
|
|
46
|
-
|
|
46
|
+
it('unpins a message successfully', async () => {
|
|
47
47
|
await (mockClient as SlackClient).unpinMessage('C001', '1234567890.123456')
|
|
48
48
|
expect(mockClient.unpinMessage).toHaveBeenCalledWith('C001', '1234567890.123456')
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
it('throws error when API fails', async () => {
|
|
52
52
|
mockClient.unpinMessage = mock(async () => {
|
|
53
53
|
throw new Error('no_pin')
|
|
54
54
|
})
|
|
@@ -57,14 +57,14 @@ describe('Pin Commands', () => {
|
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
describe('pin list', () => {
|
|
60
|
-
|
|
60
|
+
it('lists pinned messages', async () => {
|
|
61
61
|
const pins = await (mockClient as SlackClient).listPins('C001')
|
|
62
62
|
expect(pins).toHaveLength(1)
|
|
63
63
|
expect(pins[0].message.text).toBe('Pinned message')
|
|
64
64
|
expect(pins[0].created_by).toBe('U001')
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
it('throws error when API fails', async () => {
|
|
68
68
|
mockClient.listPins = mock(async () => {
|
|
69
69
|
throw new Error('channel_not_found')
|
|
70
70
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, mock,
|
|
1
|
+
import { describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { reactionCommand } from '@/platforms/slack/commands/reaction'
|
|
|
6
6
|
|
|
7
7
|
describe('reaction command', () => {
|
|
8
8
|
describe('add subcommand', () => {
|
|
9
|
-
|
|
9
|
+
it('adds reaction to message with channel and message ts', async () => {
|
|
10
10
|
const channelId = 'C123'
|
|
11
11
|
const messageTs = '1234567890.123456'
|
|
12
12
|
const emoji = 'thumbsup'
|
|
@@ -18,7 +18,7 @@ describe('reaction command', () => {
|
|
|
18
18
|
expect(mockAddReaction).toHaveBeenCalledTimes(1)
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
it('handles emoji without colons', async () => {
|
|
22
22
|
const channelId = 'C123'
|
|
23
23
|
const messageTs = '1234567890.123456'
|
|
24
24
|
const emoji = 'thumbsup'
|
|
@@ -31,7 +31,7 @@ describe('reaction command', () => {
|
|
|
31
31
|
})
|
|
32
32
|
|
|
33
33
|
describe('remove subcommand', () => {
|
|
34
|
-
|
|
34
|
+
it('removes reaction from message with channel and message ts', async () => {
|
|
35
35
|
const channelId = 'C123'
|
|
36
36
|
const messageTs = '1234567890.123456'
|
|
37
37
|
const emoji = 'thumbsup'
|
|
@@ -45,7 +45,7 @@ describe('reaction command', () => {
|
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
describe('list subcommand', () => {
|
|
48
|
-
|
|
48
|
+
it('lists reactions on a message', async () => {
|
|
49
49
|
const messageTs = '1234567890.123456'
|
|
50
50
|
const mockMessage = {
|
|
51
51
|
ts: messageTs,
|
|
@@ -66,7 +66,7 @@ describe('reaction command', () => {
|
|
|
66
66
|
expect(result!.reactions).toHaveLength(2)
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
it('returns empty reactions list when no reactions', async () => {
|
|
70
70
|
const messageTs = '1234567890.123456'
|
|
71
71
|
const mockMessage = {
|
|
72
72
|
ts: messageTs,
|
|
@@ -83,7 +83,7 @@ describe('reaction command', () => {
|
|
|
83
83
|
expect(result!.reactions).toEqual([])
|
|
84
84
|
})
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
it('returns null when message not found', async () => {
|
|
87
87
|
const mockGetMessage = mock(() => Promise.resolve(null))
|
|
88
88
|
const result = await mockGetMessage()
|
|
89
89
|
|
|
@@ -92,15 +92,15 @@ describe('reaction command', () => {
|
|
|
92
92
|
})
|
|
93
93
|
|
|
94
94
|
describe('command structure', () => {
|
|
95
|
-
|
|
95
|
+
it('reaction command exists', () => {
|
|
96
96
|
expect(reactionCommand).toBeInstanceOf(Command)
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
it('reaction command has correct name', () => {
|
|
100
100
|
expect(reactionCommand.name()).toBe('reaction')
|
|
101
101
|
})
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
it('reaction command has description', () => {
|
|
104
104
|
expect(reactionCommand.description()).toBe('Reaction commands')
|
|
105
105
|
})
|
|
106
106
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { SlackClient } from '@/platforms/slack/client'
|
|
4
4
|
import type { SlackReminder } from '@/platforms/slack/types'
|
|
@@ -26,13 +26,13 @@ describe('Reminder Commands', () => {
|
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
describe('reminder add', () => {
|
|
29
|
-
|
|
29
|
+
it('adds a reminder successfully', async () => {
|
|
30
30
|
const result = await (mockClient as SlackClient).addReminder('Do something important', 1700000000)
|
|
31
31
|
expect(result.id).toBe('Rm001')
|
|
32
32
|
expect(result.text).toBe('Do something important')
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
it('throws error when API fails', async () => {
|
|
36
36
|
mockClient.addReminder = mock(async () => {
|
|
37
37
|
throw new Error('invalid_time')
|
|
38
38
|
})
|
|
@@ -41,14 +41,14 @@ describe('Reminder Commands', () => {
|
|
|
41
41
|
})
|
|
42
42
|
|
|
43
43
|
describe('reminder list', () => {
|
|
44
|
-
|
|
44
|
+
it('lists all reminders', async () => {
|
|
45
45
|
const reminders = await (mockClient as SlackClient).listReminders()
|
|
46
46
|
expect(reminders).toHaveLength(1)
|
|
47
47
|
expect(reminders[0].text).toBe('Do something important')
|
|
48
48
|
expect(reminders[0].recurring).toBe(false)
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
it('throws error when API fails', async () => {
|
|
52
52
|
mockClient.listReminders = mock(async () => {
|
|
53
53
|
throw new Error('invalid_auth')
|
|
54
54
|
})
|
|
@@ -57,12 +57,12 @@ describe('Reminder Commands', () => {
|
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
describe('reminder complete', () => {
|
|
60
|
-
|
|
60
|
+
it('completes a reminder successfully', async () => {
|
|
61
61
|
await (mockClient as SlackClient).completeReminder('Rm001')
|
|
62
62
|
expect(mockClient.completeReminder).toHaveBeenCalledWith('Rm001')
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
it('throws error when API fails', async () => {
|
|
66
66
|
mockClient.completeReminder = mock(async () => {
|
|
67
67
|
throw new Error('reminder_not_found')
|
|
68
68
|
})
|
|
@@ -71,12 +71,12 @@ describe('Reminder Commands', () => {
|
|
|
71
71
|
})
|
|
72
72
|
|
|
73
73
|
describe('reminder delete', () => {
|
|
74
|
-
|
|
74
|
+
it('deletes a reminder successfully', async () => {
|
|
75
75
|
await (mockClient as SlackClient).deleteReminder('Rm001')
|
|
76
76
|
expect(mockClient.deleteReminder).toHaveBeenCalledWith('Rm001')
|
|
77
77
|
})
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
it('throws error when API fails', async () => {
|
|
80
80
|
mockClient.deleteReminder = mock(async () => {
|
|
81
81
|
throw new Error('reminder_not_found')
|
|
82
82
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { SlackClient } from '@/platforms/slack/client'
|
|
4
4
|
import type { SlackSavedItem } from '@/platforms/slack/types'
|
|
@@ -73,7 +73,7 @@ describe('Saved Commands', () => {
|
|
|
73
73
|
})
|
|
74
74
|
|
|
75
75
|
describe('saved list', () => {
|
|
76
|
-
|
|
76
|
+
it('lists saved items', async () => {
|
|
77
77
|
// Given: SlackClient returns saved items
|
|
78
78
|
// When: Listing saved items
|
|
79
79
|
const result = await mockClient.getSavedItems()
|
|
@@ -86,7 +86,7 @@ describe('Saved Commands', () => {
|
|
|
86
86
|
expect(result.next_cursor).toBe('next_page')
|
|
87
87
|
})
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
it('supports pagination with cursor', async () => {
|
|
90
90
|
// Given: SlackClient returns paginated results
|
|
91
91
|
// When: Fetching with cursor
|
|
92
92
|
const result = await mockClient.getSavedItems('next_page')
|
|
@@ -97,7 +97,7 @@ describe('Saved Commands', () => {
|
|
|
97
97
|
expect(result.has_more).toBe(false)
|
|
98
98
|
})
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
it('returns channel information with saved items', async () => {
|
|
101
101
|
// Given: SlackClient returns saved items with channel info
|
|
102
102
|
// When: Listing saved items
|
|
103
103
|
const result = await mockClient.getSavedItems()
|
|
@@ -109,7 +109,7 @@ describe('Saved Commands', () => {
|
|
|
109
109
|
expect(result.items[1].channel.name).toBe('random')
|
|
110
110
|
})
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
it('includes date_created timestamp', async () => {
|
|
113
113
|
// Given: SlackClient returns saved items
|
|
114
114
|
// When: Listing saved items
|
|
115
115
|
const result = await mockClient.getSavedItems()
|
|
@@ -121,14 +121,14 @@ describe('Saved Commands', () => {
|
|
|
121
121
|
})
|
|
122
122
|
|
|
123
123
|
describe('CLI command: saved list', () => {
|
|
124
|
-
|
|
124
|
+
it('supports --limit option', async () => {
|
|
125
125
|
// Given: CLI command with --limit 50
|
|
126
126
|
// When: Executing saved list --limit 50
|
|
127
127
|
// Then: Should pass limit to API (tested via integration)
|
|
128
128
|
expect(true).toBe(true)
|
|
129
129
|
})
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
it('supports --cursor option for pagination', async () => {
|
|
132
132
|
// Given: CLI command with --cursor next_page
|
|
133
133
|
// When: Executing saved list --cursor next_page
|
|
134
134
|
const result = await mockClient.getSavedItems('next_page')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { SlackClient } from '@/platforms/slack/client'
|
|
4
4
|
|
|
@@ -35,7 +35,7 @@ describe('Sections Commands', () => {
|
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
describe('sections list', () => {
|
|
38
|
-
|
|
38
|
+
it('lists all channel sections', async () => {
|
|
39
39
|
// Given: SlackClient returns channel sections
|
|
40
40
|
// When: Listing sections
|
|
41
41
|
const sections = await mockClient.getChannelSections()
|
|
@@ -47,7 +47,7 @@ describe('Sections Commands', () => {
|
|
|
47
47
|
expect(sections[2].name).toBe('Archive')
|
|
48
48
|
})
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
it('returns sections with channel IDs', async () => {
|
|
51
51
|
// Given: SlackClient returns sections with channels
|
|
52
52
|
// When: Listing sections
|
|
53
53
|
const sections = await mockClient.getChannelSections()
|
|
@@ -58,7 +58,7 @@ describe('Sections Commands', () => {
|
|
|
58
58
|
expect(sections[1].channel_ids).toHaveLength(2)
|
|
59
59
|
})
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
it('returns sections with timestamps', async () => {
|
|
62
62
|
// Given: SlackClient returns sections
|
|
63
63
|
// When: Listing sections
|
|
64
64
|
const sections = await mockClient.getChannelSections()
|
|
@@ -68,7 +68,7 @@ describe('Sections Commands', () => {
|
|
|
68
68
|
expect(sections[0].date_updated).toBe(1234567900)
|
|
69
69
|
})
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
it('handles empty sections', async () => {
|
|
72
72
|
// Given: SlackClient returns section with no channels
|
|
73
73
|
// When: Listing sections
|
|
74
74
|
const sections = await mockClient.getChannelSections()
|