agent-messenger 2.10.1 → 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 +9 -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 +109 -49
- package/src/platforms/teams/token-extractor.ts +7 -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
|
TeamsChannelSchema,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from './types'
|
|
14
14
|
|
|
15
15
|
// TeamsTeamSchema tests
|
|
16
|
-
|
|
16
|
+
it('TeamsTeamSchema validates correct team', () => {
|
|
17
17
|
const result = TeamsTeamSchema.safeParse({
|
|
18
18
|
id: '19:abc123@thread.tacv2',
|
|
19
19
|
name: 'Test Team',
|
|
@@ -21,7 +21,7 @@ test('TeamsTeamSchema validates correct team', () => {
|
|
|
21
21
|
expect(result.success).toBe(true)
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
it('TeamsTeamSchema validates team with optional description', () => {
|
|
25
25
|
const result = TeamsTeamSchema.safeParse({
|
|
26
26
|
id: '19:abc123@thread.tacv2',
|
|
27
27
|
name: 'Test Team',
|
|
@@ -30,14 +30,14 @@ test('TeamsTeamSchema validates team with optional description', () => {
|
|
|
30
30
|
expect(result.success).toBe(true)
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
it('TeamsTeamSchema rejects missing id', () => {
|
|
34
34
|
const result = TeamsTeamSchema.safeParse({
|
|
35
35
|
name: 'Test Team',
|
|
36
36
|
})
|
|
37
37
|
expect(result.success).toBe(false)
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
it('TeamsTeamSchema rejects missing name', () => {
|
|
41
41
|
const result = TeamsTeamSchema.safeParse({
|
|
42
42
|
id: '19:abc123@thread.tacv2',
|
|
43
43
|
})
|
|
@@ -45,7 +45,7 @@ test('TeamsTeamSchema rejects missing name', () => {
|
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
// TeamsChannelSchema tests
|
|
48
|
-
|
|
48
|
+
it('TeamsChannelSchema validates correct channel', () => {
|
|
49
49
|
const result = TeamsChannelSchema.safeParse({
|
|
50
50
|
id: '19:channel123@thread.tacv2',
|
|
51
51
|
team_id: '19:abc123@thread.tacv2',
|
|
@@ -55,7 +55,7 @@ test('TeamsChannelSchema validates correct channel', () => {
|
|
|
55
55
|
expect(result.success).toBe(true)
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
it('TeamsChannelSchema rejects missing required fields', () => {
|
|
59
59
|
const result = TeamsChannelSchema.safeParse({
|
|
60
60
|
id: '19:channel123@thread.tacv2',
|
|
61
61
|
name: 'General',
|
|
@@ -64,7 +64,7 @@ test('TeamsChannelSchema rejects missing required fields', () => {
|
|
|
64
64
|
})
|
|
65
65
|
|
|
66
66
|
// TeamsMessageSchema tests
|
|
67
|
-
|
|
67
|
+
it('TeamsMessageSchema validates correct message', () => {
|
|
68
68
|
const result = TeamsMessageSchema.safeParse({
|
|
69
69
|
id: '1234567890123',
|
|
70
70
|
channel_id: '19:channel123@thread.tacv2',
|
|
@@ -78,7 +78,7 @@ test('TeamsMessageSchema validates correct message', () => {
|
|
|
78
78
|
expect(result.success).toBe(true)
|
|
79
79
|
})
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
it('TeamsMessageSchema rejects missing required fields', () => {
|
|
82
82
|
const result = TeamsMessageSchema.safeParse({
|
|
83
83
|
id: '1234567890123',
|
|
84
84
|
channel_id: '19:channel123@thread.tacv2',
|
|
@@ -88,7 +88,7 @@ test('TeamsMessageSchema rejects missing required fields', () => {
|
|
|
88
88
|
})
|
|
89
89
|
|
|
90
90
|
// TeamsUserSchema tests
|
|
91
|
-
|
|
91
|
+
it('TeamsUserSchema validates correct user', () => {
|
|
92
92
|
const result = TeamsUserSchema.safeParse({
|
|
93
93
|
id: 'user123',
|
|
94
94
|
displayName: 'Test User',
|
|
@@ -96,7 +96,7 @@ test('TeamsUserSchema validates correct user', () => {
|
|
|
96
96
|
expect(result.success).toBe(true)
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
it('TeamsUserSchema validates user with optional fields', () => {
|
|
100
100
|
const result = TeamsUserSchema.safeParse({
|
|
101
101
|
id: 'user123',
|
|
102
102
|
displayName: 'Test User',
|
|
@@ -106,7 +106,7 @@ test('TeamsUserSchema validates user with optional fields', () => {
|
|
|
106
106
|
expect(result.success).toBe(true)
|
|
107
107
|
})
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
it('TeamsUserSchema rejects missing required fields', () => {
|
|
110
110
|
const result = TeamsUserSchema.safeParse({
|
|
111
111
|
id: 'user123',
|
|
112
112
|
})
|
|
@@ -114,7 +114,7 @@ test('TeamsUserSchema rejects missing required fields', () => {
|
|
|
114
114
|
})
|
|
115
115
|
|
|
116
116
|
// TeamsReactionSchema tests
|
|
117
|
-
|
|
117
|
+
it('TeamsReactionSchema validates correct reaction', () => {
|
|
118
118
|
const result = TeamsReactionSchema.safeParse({
|
|
119
119
|
emoji: 'like',
|
|
120
120
|
count: 5,
|
|
@@ -122,7 +122,7 @@ test('TeamsReactionSchema validates correct reaction', () => {
|
|
|
122
122
|
expect(result.success).toBe(true)
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
it('TeamsReactionSchema rejects missing required fields', () => {
|
|
126
126
|
const result = TeamsReactionSchema.safeParse({
|
|
127
127
|
emoji: 'like',
|
|
128
128
|
})
|
|
@@ -130,7 +130,7 @@ test('TeamsReactionSchema rejects missing required fields', () => {
|
|
|
130
130
|
})
|
|
131
131
|
|
|
132
132
|
// TeamsFileSchema tests
|
|
133
|
-
|
|
133
|
+
it('TeamsFileSchema validates correct file', () => {
|
|
134
134
|
const result = TeamsFileSchema.safeParse({
|
|
135
135
|
id: 'file123',
|
|
136
136
|
name: 'document.pdf',
|
|
@@ -140,7 +140,7 @@ test('TeamsFileSchema validates correct file', () => {
|
|
|
140
140
|
expect(result.success).toBe(true)
|
|
141
141
|
})
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
it('TeamsFileSchema validates file with optional contentType', () => {
|
|
144
144
|
const result = TeamsFileSchema.safeParse({
|
|
145
145
|
id: 'file123',
|
|
146
146
|
name: 'document.pdf',
|
|
@@ -151,7 +151,7 @@ test('TeamsFileSchema validates file with optional contentType', () => {
|
|
|
151
151
|
expect(result.success).toBe(true)
|
|
152
152
|
})
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
it('TeamsFileSchema rejects missing required fields', () => {
|
|
155
155
|
const result = TeamsFileSchema.safeParse({
|
|
156
156
|
id: 'file123',
|
|
157
157
|
name: 'document.pdf',
|
|
@@ -160,14 +160,14 @@ test('TeamsFileSchema rejects missing required fields', () => {
|
|
|
160
160
|
})
|
|
161
161
|
|
|
162
162
|
// TeamsCredentialsSchema tests
|
|
163
|
-
|
|
163
|
+
it('TeamsCredentialsSchema validates correct credentials', () => {
|
|
164
164
|
const result = TeamsCredentialsSchema.safeParse({
|
|
165
165
|
token: 'skypetoken_value',
|
|
166
166
|
})
|
|
167
167
|
expect(result.success).toBe(true)
|
|
168
168
|
})
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
it('TeamsCredentialsSchema validates credentials with cookie', () => {
|
|
171
171
|
const result = TeamsCredentialsSchema.safeParse({
|
|
172
172
|
token: 'skypetoken_value',
|
|
173
173
|
cookie: 'skypetoken_asm_value',
|
|
@@ -175,13 +175,13 @@ test('TeamsCredentialsSchema validates credentials with cookie', () => {
|
|
|
175
175
|
expect(result.success).toBe(true)
|
|
176
176
|
})
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
it('TeamsCredentialsSchema rejects missing token', () => {
|
|
179
179
|
const result = TeamsCredentialsSchema.safeParse({})
|
|
180
180
|
expect(result.success).toBe(false)
|
|
181
181
|
})
|
|
182
182
|
|
|
183
183
|
// TeamsConfigSchema tests
|
|
184
|
-
|
|
184
|
+
it('TeamsConfigSchema validates correct config', () => {
|
|
185
185
|
const result = TeamsConfigSchema.safeParse({
|
|
186
186
|
current_account: 'work',
|
|
187
187
|
accounts: {
|
|
@@ -196,7 +196,7 @@ test('TeamsConfigSchema validates correct config', () => {
|
|
|
196
196
|
expect(result.success).toBe(true)
|
|
197
197
|
})
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
it('TeamsConfigSchema validates config with multiple accounts', () => {
|
|
200
200
|
const result = TeamsConfigSchema.safeParse({
|
|
201
201
|
current_account: 'work',
|
|
202
202
|
accounts: {
|
|
@@ -225,7 +225,7 @@ test('TeamsConfigSchema validates config with multiple accounts', () => {
|
|
|
225
225
|
expect(result.success).toBe(true)
|
|
226
226
|
})
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
it('TeamsConfigSchema rejects invalid region', () => {
|
|
229
229
|
const result = TeamsConfigSchema.safeParse({
|
|
230
230
|
current_account: 'work',
|
|
231
231
|
accounts: {
|
|
@@ -241,7 +241,7 @@ test('TeamsConfigSchema rejects invalid region', () => {
|
|
|
241
241
|
expect(result.success).toBe(false)
|
|
242
242
|
})
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
it('TeamsConfigSchema rejects missing required fields', () => {
|
|
245
245
|
const result = TeamsConfigSchema.safeParse({
|
|
246
246
|
current_account: null,
|
|
247
247
|
})
|
|
@@ -249,14 +249,14 @@ test('TeamsConfigSchema rejects missing required fields', () => {
|
|
|
249
249
|
})
|
|
250
250
|
|
|
251
251
|
// TeamsError tests
|
|
252
|
-
|
|
252
|
+
it('TeamsError has correct name and code', () => {
|
|
253
253
|
const error = new TeamsError('Test error', 'TEST_CODE')
|
|
254
254
|
expect(error.name).toBe('TeamsError')
|
|
255
255
|
expect(error.message).toBe('Test error')
|
|
256
256
|
expect(error.code).toBe('TEST_CODE')
|
|
257
257
|
})
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
it('TeamsError is instance of Error', () => {
|
|
260
260
|
const error = new TeamsError('Test error', 'TEST_CODE')
|
|
261
261
|
expect(error instanceof Error).toBe(true)
|
|
262
262
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect,
|
|
1
|
+
import { beforeEach, describe, expect, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { getTelegramAppCredentials } from './app-config'
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ describe('telegram app config', () => {
|
|
|
16
16
|
}
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
it('returns env credentials when provided', () => {
|
|
20
20
|
process.env.AGENT_TELEGRAM_API_ID = '12345'
|
|
21
21
|
process.env.AGENT_TELEGRAM_API_HASH = 'secret'
|
|
22
22
|
|
|
@@ -27,11 +27,11 @@ describe('telegram app config', () => {
|
|
|
27
27
|
})
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
it('returns none when nothing is configured', () => {
|
|
31
31
|
expect(getTelegramAppCredentials()).toEqual({ source: 'none' })
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
it('rejects malformed api_id like "123abc"', () => {
|
|
35
35
|
const prev = process.env.AGENT_TELEGRAM_API_ID
|
|
36
36
|
process.env.AGENT_TELEGRAM_API_ID = '123abc'
|
|
37
37
|
process.env.AGENT_TELEGRAM_API_HASH = 'abc123'
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { findFuzzyChats, mergeChats, normalizeChatSearchText } from './chat-utils'
|
|
4
4
|
|
|
5
5
|
describe('normalizeChatSearchText', () => {
|
|
6
|
-
|
|
6
|
+
it('lowercases and strips spaces', () => {
|
|
7
7
|
expect(normalizeChatSearchText('Hello World')).toBe('helloworld')
|
|
8
8
|
})
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
it('strips special chars', () => {
|
|
11
11
|
expect(normalizeChatSearchText('ops-alerts!')).toBe('opsalerts')
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
it('handles empty string', () => {
|
|
15
15
|
expect(normalizeChatSearchText('')).toBe('')
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
it('preserves unicode letters and digits', () => {
|
|
19
19
|
const result = normalizeChatSearchText('안녕 World 123')
|
|
20
20
|
expect(result).toContain('안녕')
|
|
21
21
|
expect(result).toContain('world')
|
|
@@ -30,26 +30,26 @@ describe('findFuzzyChats', () => {
|
|
|
30
30
|
{ id: 3, title: 'ops-team', type: 'group' },
|
|
31
31
|
] as any[]
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
it('finds partial matches case-insensitively', () => {
|
|
34
34
|
const result = findFuzzyChats(chats, 'ops', 10)
|
|
35
35
|
expect(result.map((c) => c.id)).toContain(1)
|
|
36
36
|
expect(result.map((c) => c.id)).toContain(3)
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
it('returns empty for no matches', () => {
|
|
40
40
|
expect(findFuzzyChats(chats, 'zzz', 10)).toHaveLength(0)
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
it('returns empty for empty query', () => {
|
|
44
44
|
expect(findFuzzyChats(chats, '', 10)).toHaveLength(0)
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
it('respects limit', () => {
|
|
48
48
|
const result = findFuzzyChats(chats, 'o', 1)
|
|
49
49
|
expect(result).toHaveLength(1)
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
it('does not match chats with empty normalized title', () => {
|
|
53
53
|
const chats = [{ id: 99, title: '---', type: 'group' }] as any[]
|
|
54
54
|
expect(findFuzzyChats(chats, 'ops', 10)).toHaveLength(0)
|
|
55
55
|
})
|
|
@@ -62,13 +62,13 @@ describe('mergeChats', () => {
|
|
|
62
62
|
{ id: 2, title: 'B', type: 'group' },
|
|
63
63
|
] as any[]
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
it('deduplicates by id', () => {
|
|
66
66
|
const result = mergeChats(a, b)
|
|
67
67
|
expect(result).toHaveLength(2)
|
|
68
68
|
expect(result.map((c) => c.id)).toEqual([1, 2])
|
|
69
69
|
})
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
it('gives primary array precedence in order', () => {
|
|
72
72
|
const result = mergeChats(a, b)
|
|
73
73
|
expect(result[0].id).toBe(1)
|
|
74
74
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, mock,
|
|
1
|
+
import { describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { TelegramTdlibClient } from './client'
|
|
4
4
|
import type { TelegramAccount, TelegramAccountPaths } from './types'
|
|
@@ -46,7 +46,7 @@ function pushAuthReady(events: any[], extra: string) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
describe('listChats', () => {
|
|
49
|
-
|
|
49
|
+
it('loads chats across multiple loadChats calls until 404', async () => {
|
|
50
50
|
let loadChatsCallCount = 0
|
|
51
51
|
const allChatIds = [1, 2, 3, 4, 5]
|
|
52
52
|
|
|
@@ -116,7 +116,7 @@ describe('listChats', () => {
|
|
|
116
116
|
expect(loadChatsCallCount).toBe(3)
|
|
117
117
|
})
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
it('stops loading when enough chats are cached before 404', async () => {
|
|
120
120
|
let loadChatsCallCount = 0
|
|
121
121
|
|
|
122
122
|
const { client } = createMockClient((request, events) => {
|
|
@@ -164,7 +164,7 @@ describe('listChats', () => {
|
|
|
164
164
|
})
|
|
165
165
|
|
|
166
166
|
describe('sendMessage confirmation', () => {
|
|
167
|
-
|
|
167
|
+
it('returns confirmed message id when updateMessageSendSucceeded arrives', async () => {
|
|
168
168
|
const tempId = 100
|
|
169
169
|
const serverId = 999
|
|
170
170
|
const events: any[] = []
|
|
@@ -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 { getNonInteractiveLoginMessage, promptNextLoginInput } from './auth'
|
|
4
4
|
|
|
@@ -19,37 +19,37 @@ describe('promptNextLoginInput non-interactive', () => {
|
|
|
19
19
|
Object.defineProperty(process.stdout, 'isTTY', { value: originalStdoutTTY, writable: true, configurable: true })
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
it('returns null for provide_phone_number', async () => {
|
|
23
23
|
const result = await promptNextLoginInput({ next_action: 'provide_phone_number' }, {})
|
|
24
24
|
expect(result).toBeNull()
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
it('returns null for provide_code', async () => {
|
|
28
28
|
const result = await promptNextLoginInput({ next_action: 'provide_code' }, {})
|
|
29
29
|
expect(result).toBeNull()
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
it('returns null for provide_password', async () => {
|
|
33
33
|
const result = await promptNextLoginInput({ next_action: 'provide_password' }, {})
|
|
34
34
|
expect(result).toBeNull()
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
it('returns null for provide_email', async () => {
|
|
38
38
|
const result = await promptNextLoginInput({ next_action: 'provide_email' }, {})
|
|
39
39
|
expect(result).toBeNull()
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
it('returns null for provide_email_code', async () => {
|
|
43
43
|
const result = await promptNextLoginInput({ next_action: 'provide_email_code' }, {})
|
|
44
44
|
expect(result).toBeNull()
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
it('returns null for provide_registration', async () => {
|
|
48
48
|
const result = await promptNextLoginInput({ next_action: 'provide_registration' }, {})
|
|
49
49
|
expect(result).toBeNull()
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
it('returns options unchanged for unknown next_action', async () => {
|
|
53
53
|
const options = { phone: '+14155551234' }
|
|
54
54
|
const result = await promptNextLoginInput({ next_action: undefined }, options)
|
|
55
55
|
|
|
@@ -59,56 +59,56 @@ describe('promptNextLoginInput non-interactive', () => {
|
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
describe('getNonInteractiveLoginMessage', () => {
|
|
62
|
-
|
|
62
|
+
it('maps provide_phone_number to provide_phone with --phone hint', () => {
|
|
63
63
|
const msg = getNonInteractiveLoginMessage('provide_phone_number')
|
|
64
64
|
expect(msg).not.toBeNull()
|
|
65
65
|
expect(msg!.next_action).toBe('provide_phone')
|
|
66
66
|
expect(msg!.message).toContain('--phone')
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
it('maps provide_code with --code hint', () => {
|
|
70
70
|
const msg = getNonInteractiveLoginMessage('provide_code')
|
|
71
71
|
expect(msg).not.toBeNull()
|
|
72
72
|
expect(msg!.next_action).toBe('provide_code')
|
|
73
73
|
expect(msg!.message).toContain('--code')
|
|
74
74
|
})
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
it('maps provide_password with --password hint', () => {
|
|
77
77
|
const msg = getNonInteractiveLoginMessage('provide_password')
|
|
78
78
|
expect(msg).not.toBeNull()
|
|
79
79
|
expect(msg!.next_action).toBe('provide_password')
|
|
80
80
|
expect(msg!.message).toContain('--password')
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
it('maps provide_email with --email hint', () => {
|
|
84
84
|
const msg = getNonInteractiveLoginMessage('provide_email')
|
|
85
85
|
expect(msg).not.toBeNull()
|
|
86
86
|
expect(msg!.next_action).toBe('provide_email')
|
|
87
87
|
expect(msg!.message).toContain('--email')
|
|
88
88
|
})
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
it('maps provide_email_code with --email-code hint', () => {
|
|
91
91
|
const msg = getNonInteractiveLoginMessage('provide_email_code')
|
|
92
92
|
expect(msg).not.toBeNull()
|
|
93
93
|
expect(msg!.next_action).toBe('provide_email_code')
|
|
94
94
|
expect(msg!.message).toContain('--email-code')
|
|
95
95
|
})
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
it('maps provide_registration with --first-name hint', () => {
|
|
98
98
|
const msg = getNonInteractiveLoginMessage('provide_registration')
|
|
99
99
|
expect(msg).not.toBeNull()
|
|
100
100
|
expect(msg!.next_action).toBe('provide_registration')
|
|
101
101
|
expect(msg!.message).toContain('--first-name')
|
|
102
102
|
})
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
it('maps provide_provisioning_code with --provisioning-code hint', () => {
|
|
105
105
|
const msg = getNonInteractiveLoginMessage('provide_provisioning_code')
|
|
106
106
|
expect(msg).not.toBeNull()
|
|
107
107
|
expect(msg!.next_action).toBe('provide_provisioning_code')
|
|
108
108
|
expect(msg!.message).toContain('--provisioning-code')
|
|
109
109
|
})
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
it('returns null for unknown action', () => {
|
|
112
112
|
expect(getNonInteractiveLoginMessage('unknown_action')).toBeNull()
|
|
113
113
|
})
|
|
114
114
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, mock, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, mock, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
const mockListChats = mock(() =>
|
|
4
4
|
Promise.resolve([
|
|
@@ -55,19 +55,19 @@ describe('chat commands', () => {
|
|
|
55
55
|
})
|
|
56
56
|
|
|
57
57
|
describe('list subcommand', () => {
|
|
58
|
-
|
|
58
|
+
it('calls listChats with default limit', async () => {
|
|
59
59
|
await chatCommand.parseAsync(['list'], { from: 'user' })
|
|
60
60
|
|
|
61
61
|
expect(mockListChats).toHaveBeenCalledWith(20)
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
it('calls listChats with custom limit', async () => {
|
|
65
65
|
await chatCommand.parseAsync(['list', '--limit', '5'], { from: 'user' })
|
|
66
66
|
|
|
67
67
|
expect(mockListChats).toHaveBeenCalledWith(5)
|
|
68
68
|
})
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
it('outputs JSON array to console', async () => {
|
|
71
71
|
await chatCommand.parseAsync(['list'], { from: 'user' })
|
|
72
72
|
|
|
73
73
|
expect(consoleSpy).toHaveBeenCalled()
|
|
@@ -79,19 +79,19 @@ describe('chat commands', () => {
|
|
|
79
79
|
})
|
|
80
80
|
|
|
81
81
|
describe('search subcommand', () => {
|
|
82
|
-
|
|
82
|
+
it('calls searchChats with query and default limit', async () => {
|
|
83
83
|
await chatCommand.parseAsync(['search', 'General'], { from: 'user' })
|
|
84
84
|
|
|
85
85
|
expect(mockSearchChats).toHaveBeenCalledWith('General', 20)
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
it('calls searchChats with query and custom limit', async () => {
|
|
89
89
|
await chatCommand.parseAsync(['search', 'General', '--limit', '3'], { from: 'user' })
|
|
90
90
|
|
|
91
91
|
expect(mockSearchChats).toHaveBeenCalledWith('General', 3)
|
|
92
92
|
})
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
it('outputs JSON array to console', async () => {
|
|
95
95
|
await chatCommand.parseAsync(['search', 'General'], { from: 'user' })
|
|
96
96
|
|
|
97
97
|
expect(consoleSpy).toHaveBeenCalled()
|
|
@@ -103,13 +103,13 @@ describe('chat commands', () => {
|
|
|
103
103
|
})
|
|
104
104
|
|
|
105
105
|
describe('get subcommand', () => {
|
|
106
|
-
|
|
106
|
+
it('calls getChat with chat reference', async () => {
|
|
107
107
|
await chatCommand.parseAsync(['get', 'chat-1'], { from: 'user' })
|
|
108
108
|
|
|
109
109
|
expect(mockGetChat).toHaveBeenCalledWith('chat-1')
|
|
110
110
|
})
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
it('outputs JSON object to console', async () => {
|
|
113
113
|
await chatCommand.parseAsync(['get', 'chat-1'], { from: 'user' })
|
|
114
114
|
|
|
115
115
|
expect(consoleSpy).toHaveBeenCalled()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, mock, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, mock, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
const mockListMessages = mock(() =>
|
|
4
4
|
Promise.resolve([
|
|
@@ -46,19 +46,19 @@ describe('message commands', () => {
|
|
|
46
46
|
})
|
|
47
47
|
|
|
48
48
|
describe('list subcommand', () => {
|
|
49
|
-
|
|
49
|
+
it('calls listMessages with chat reference and default limit', async () => {
|
|
50
50
|
await messageCommand.parseAsync(['list', 'chat-123'], { from: 'user' })
|
|
51
51
|
|
|
52
52
|
expect(mockListMessages).toHaveBeenCalledWith('chat-123', 20)
|
|
53
53
|
})
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
it('calls listMessages with custom limit', async () => {
|
|
56
56
|
await messageCommand.parseAsync(['list', 'chat-123', '--limit', '10'], { from: 'user' })
|
|
57
57
|
|
|
58
58
|
expect(mockListMessages).toHaveBeenCalledWith('chat-123', 10)
|
|
59
59
|
})
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
it('outputs JSON to console', async () => {
|
|
62
62
|
await messageCommand.parseAsync(['list', 'chat-123'], { from: 'user' })
|
|
63
63
|
|
|
64
64
|
expect(consoleSpy).toHaveBeenCalled()
|
|
@@ -70,13 +70,13 @@ describe('message commands', () => {
|
|
|
70
70
|
})
|
|
71
71
|
|
|
72
72
|
describe('send subcommand', () => {
|
|
73
|
-
|
|
73
|
+
it('calls sendMessage with chat reference and text', async () => {
|
|
74
74
|
await messageCommand.parseAsync(['send', 'chat-123', 'Hello there'], { from: 'user' })
|
|
75
75
|
|
|
76
76
|
expect(mockSendMessage).toHaveBeenCalledWith('chat-123', 'Hello there')
|
|
77
77
|
})
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
it('outputs JSON to console', async () => {
|
|
80
80
|
await messageCommand.parseAsync(['send', 'chat-123', 'Hello there'], { from: 'user' })
|
|
81
81
|
|
|
82
82
|
expect(consoleSpy).toHaveBeenCalled()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { TelegramError } from '../types'
|
|
4
4
|
import { parseLimitOption } from './shared'
|
|
5
5
|
|
|
6
6
|
describe('telegram shared command helpers', () => {
|
|
7
|
-
|
|
7
|
+
it('parseLimitOption accepts normal integer strings', () => {
|
|
8
8
|
expect(parseLimitOption('10', 20)).toBe(10)
|
|
9
9
|
})
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
it('parseLimitOption rejects malformed numeric prefixes', () => {
|
|
12
12
|
expect(() => parseLimitOption('10abc', 20)).toThrow(TelegramError)
|
|
13
13
|
expect(() => parseLimitOption('1.5', 20)).toThrow(TelegramError)
|
|
14
14
|
expect(() => parseLimitOption('2e3', 20)).toThrow(TelegramError)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, spyOn,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, spyOn, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { TelegramTdlibClient } from '../client'
|
|
4
4
|
import { TelegramCredentialManager } from '../credential-manager'
|
|
@@ -41,7 +41,7 @@ describe('whoami command', () => {
|
|
|
41
41
|
consoleLogSpy?.mockRestore()
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
it('outputs account info with user when authenticated', async () => {
|
|
45
45
|
await whoamiAction({})
|
|
46
46
|
|
|
47
47
|
expect(consoleLogSpy).toHaveBeenCalledTimes(1)
|
|
@@ -54,7 +54,7 @@ describe('whoami command', () => {
|
|
|
54
54
|
expect(output.user.username).toBe('testuser')
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
it('omits user field when not present', async () => {
|
|
58
58
|
getAuthStatusSpy.mockResolvedValue({
|
|
59
59
|
account_id: 'plus-12025551234',
|
|
60
60
|
phone_number: '+12025551234',
|