@yaebal/test 0.1.0 → 0.2.0
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/README.md +333 -160
- package/lib/api.d.ts +83 -0
- package/lib/api.d.ts.map +1 -0
- package/lib/api.js +186 -0
- package/lib/api.js.map +1 -0
- package/lib/api.test.d.ts +2 -0
- package/lib/api.test.d.ts.map +1 -0
- package/lib/api.test.js +131 -0
- package/lib/api.test.js.map +1 -0
- package/lib/bot-messages.d.ts +42 -0
- package/lib/bot-messages.d.ts.map +1 -0
- package/lib/bot-messages.js +72 -0
- package/lib/bot-messages.js.map +1 -0
- package/lib/chat-actor.d.ts +45 -0
- package/lib/chat-actor.d.ts.map +1 -0
- package/lib/chat-actor.js +72 -0
- package/lib/chat-actor.js.map +1 -0
- package/lib/clock.d.ts +22 -0
- package/lib/clock.d.ts.map +1 -0
- package/lib/clock.js +72 -0
- package/lib/clock.js.map +1 -0
- package/lib/clock.test.d.ts +2 -0
- package/lib/clock.test.d.ts.map +1 -0
- package/lib/clock.test.js +69 -0
- package/lib/clock.test.js.map +1 -0
- package/lib/env.d.ts +100 -0
- package/lib/env.d.ts.map +1 -0
- package/lib/env.js +164 -0
- package/lib/env.js.map +1 -0
- package/lib/env.test.d.ts +2 -0
- package/lib/env.test.d.ts.map +1 -0
- package/lib/env.test.js +302 -0
- package/lib/env.test.js.map +1 -0
- package/lib/fetch.d.ts +3 -0
- package/lib/fetch.d.ts.map +1 -0
- package/lib/fetch.js +12 -0
- package/lib/fetch.js.map +1 -0
- package/lib/index.d.ts +19 -205
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -391
- package/lib/index.js.map +1 -1
- package/lib/internal.d.ts +25 -0
- package/lib/internal.d.ts.map +1 -0
- package/lib/internal.js +19 -0
- package/lib/internal.js.map +1 -0
- package/lib/keyboard.d.ts +15 -0
- package/lib/keyboard.d.ts.map +1 -0
- package/lib/keyboard.js +25 -0
- package/lib/keyboard.js.map +1 -0
- package/lib/keyboard.test.d.ts +2 -0
- package/lib/keyboard.test.d.ts.map +1 -0
- package/lib/keyboard.test.js +31 -0
- package/lib/keyboard.test.js.map +1 -0
- package/lib/normalize.d.ts +10 -0
- package/lib/normalize.d.ts.map +1 -0
- package/lib/normalize.js +27 -0
- package/lib/normalize.js.map +1 -0
- package/lib/reactions.d.ts +3 -0
- package/lib/reactions.d.ts.map +1 -0
- package/lib/reactions.js +17 -0
- package/lib/reactions.js.map +1 -0
- package/lib/updates.d.ts +126 -0
- package/lib/updates.d.ts.map +1 -0
- package/lib/updates.js +200 -0
- package/lib/updates.js.map +1 -0
- package/lib/updates.test.d.ts +2 -0
- package/lib/updates.test.d.ts.map +1 -0
- package/lib/updates.test.js +72 -0
- package/lib/updates.test.js.map +1 -0
- package/lib/user-actor.d.ts +188 -0
- package/lib/user-actor.d.ts.map +1 -0
- package/lib/user-actor.js +465 -0
- package/lib/user-actor.js.map +1 -0
- package/lib/webhook.d.ts +18 -0
- package/lib/webhook.d.ts.map +1 -0
- package/lib/webhook.js +25 -0
- package/lib/webhook.js.map +1 -0
- package/lib/webhook.test.d.ts +2 -0
- package/lib/webhook.test.d.ts.map +1 -0
- package/lib/webhook.test.js +36 -0
- package/lib/webhook.test.js.map +1 -0
- package/package.json +7 -5
- package/src/api.test.ts +180 -0
- package/src/api.ts +289 -0
- package/src/bot-messages.ts +117 -0
- package/src/chat-actor.ts +101 -0
- package/src/clock.test.ts +80 -0
- package/src/clock.ts +118 -0
- package/src/env.test.ts +370 -0
- package/src/env.ts +235 -0
- package/src/fetch.ts +11 -0
- package/src/index.ts +79 -630
- package/src/internal.ts +43 -0
- package/src/keyboard.test.ts +35 -0
- package/src/keyboard.ts +38 -0
- package/src/normalize.ts +34 -0
- package/src/reactions.ts +18 -0
- package/src/updates.test.ts +107 -0
- package/src/updates.ts +354 -0
- package/src/user-actor.ts +702 -0
- package/src/webhook.test.ts +54 -0
- package/src/webhook.ts +48 -0
- package/lib/index.test.d.ts +0 -2
- package/lib/index.test.d.ts.map +0 -1
- package/lib/index.test.js +0 -213
- package/lib/index.test.js.map +0 -1
- package/src/index.test.ts +0 -320
package/lib/env.test.js
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { bold, Composer, format } from "@yaebal/core";
|
|
4
|
+
import { apiError } from "./api.js";
|
|
5
|
+
import { createTestEnv } from "./env.js";
|
|
6
|
+
test("createUser().sendMessage dispatches a message update and records the bot's reply", async () => {
|
|
7
|
+
const bot = new Composer().on("message:text", (ctx) => ctx.reply("pong"));
|
|
8
|
+
const env = createTestEnv(bot);
|
|
9
|
+
const user = env.createUser({ firstName: "Linia" });
|
|
10
|
+
await user.sendMessage("ping");
|
|
11
|
+
assert.equal(env.apiCalls.length, 1);
|
|
12
|
+
assert.equal(env.lastApiCall()?.method, "sendMessage");
|
|
13
|
+
assert.equal(env.lastApiCall("sendMessage")?.params?.text, "pong");
|
|
14
|
+
assert.equal(env.lastApiCall()?.params?.chat_id, user.pmChat.id);
|
|
15
|
+
});
|
|
16
|
+
test("sendMessage(chat, text) sends into a group; .in(chat) scopes the same way", async () => {
|
|
17
|
+
const bot = new Composer().on("message:text", (ctx) => ctx.reply("hi group"));
|
|
18
|
+
const env = createTestEnv(bot);
|
|
19
|
+
const user = env.createUser();
|
|
20
|
+
const group = env.createChat({ type: "group", title: "devs" });
|
|
21
|
+
await user.sendMessage(group, "hello");
|
|
22
|
+
assert.equal(env.lastApiCall("sendMessage")?.params?.chat_id, group.id);
|
|
23
|
+
env.clearApiCalls();
|
|
24
|
+
await user.in(group).sendMessage("hello again");
|
|
25
|
+
assert.equal(env.lastApiCall("sendMessage")?.params?.chat_id, group.id);
|
|
26
|
+
});
|
|
27
|
+
test("sendMessage accepts a format() result — entities are auto-extracted (rich integration)", async () => {
|
|
28
|
+
let entityType;
|
|
29
|
+
const bot = new Composer().on("message:text", (ctx) => {
|
|
30
|
+
entityType = ctx.message?.entities?.[0]?.type;
|
|
31
|
+
});
|
|
32
|
+
const env = createTestEnv(bot);
|
|
33
|
+
const user = env.createUser();
|
|
34
|
+
await user.sendMessage(format `Check out ${bold("this")}`);
|
|
35
|
+
assert.equal(entityType, "bold");
|
|
36
|
+
});
|
|
37
|
+
test("sendCommand attaches a bot_command entity and parses args via Composer.command", async () => {
|
|
38
|
+
let captured;
|
|
39
|
+
const bot = new Composer().command("start", (ctx) => {
|
|
40
|
+
captured = { command: ctx.command, args: ctx.args };
|
|
41
|
+
});
|
|
42
|
+
const env = createTestEnv(bot);
|
|
43
|
+
const user = env.createUser();
|
|
44
|
+
await user.sendCommand("start", "ref42");
|
|
45
|
+
assert.deepEqual(captured, { command: "start", args: ["ref42"] });
|
|
46
|
+
});
|
|
47
|
+
test("sendReply sets reply_to_message and targets the same chat", async () => {
|
|
48
|
+
const bot = new Composer();
|
|
49
|
+
const env = createTestEnv(bot);
|
|
50
|
+
const user = env.createUser();
|
|
51
|
+
const group = env.createChat({ type: "group" });
|
|
52
|
+
const original = await user.sendMessage(group, "hello");
|
|
53
|
+
const reply = await user.sendReply(original, "nice to meet you");
|
|
54
|
+
assert.equal(reply.reply_to_message?.message_id, original.message_id);
|
|
55
|
+
assert.equal(reply.chat.id, group.id);
|
|
56
|
+
});
|
|
57
|
+
test("media shortcuts attach a plausible attachment with auto file ids, caption entities, and spoiler", async () => {
|
|
58
|
+
const bot = new Composer();
|
|
59
|
+
const env = createTestEnv(bot);
|
|
60
|
+
const user = env.createUser();
|
|
61
|
+
const photo = await user.sendPhoto({ caption: format `nice ${bold("shot")}`, spoiler: true });
|
|
62
|
+
assert.ok(photo.photo?.length);
|
|
63
|
+
assert.ok(photo.photo?.[0]?.file_id);
|
|
64
|
+
assert.equal(photo.caption, "nice shot");
|
|
65
|
+
assert.equal(photo.caption_entities?.[0]?.type, "bold");
|
|
66
|
+
assert.equal(photo.has_media_spoiler, true);
|
|
67
|
+
const sticker = await user.sendSticker({ emoji: "🔥" });
|
|
68
|
+
assert.equal(sticker.sticker?.type, "regular");
|
|
69
|
+
assert.equal(sticker.sticker?.emoji, "🔥");
|
|
70
|
+
});
|
|
71
|
+
test("sendMediaGroup dispatches one message per item, all sharing media_group_id", async () => {
|
|
72
|
+
const groupIds = [];
|
|
73
|
+
const bot = new Composer().on("message", (ctx) => {
|
|
74
|
+
if (ctx.message?.media_group_id)
|
|
75
|
+
groupIds.push(ctx.message.media_group_id);
|
|
76
|
+
});
|
|
77
|
+
const env = createTestEnv(bot);
|
|
78
|
+
const user = env.createUser();
|
|
79
|
+
const group = env.createChat({ type: "group" });
|
|
80
|
+
const [m1, m2] = await user.sendMediaGroup(group, [
|
|
81
|
+
{ photo: [{ file_id: "f1", file_unique_id: "u1", width: 100, height: 100 }] },
|
|
82
|
+
{ photo: [{ file_id: "f2", file_unique_id: "u2", width: 100, height: 100 }] },
|
|
83
|
+
]);
|
|
84
|
+
assert.equal(groupIds.length, 2);
|
|
85
|
+
assert.equal(m1?.media_group_id, m2?.media_group_id);
|
|
86
|
+
});
|
|
87
|
+
test("click() dispatches a callback_query the bot's callbackQuery() handler sees", async () => {
|
|
88
|
+
let seenData;
|
|
89
|
+
const bot = new Composer().callbackQuery("vote:up", (ctx) => {
|
|
90
|
+
seenData = ctx.callbackQuery.data;
|
|
91
|
+
});
|
|
92
|
+
const env = createTestEnv(bot);
|
|
93
|
+
const user = env.createUser();
|
|
94
|
+
await user.click("vote:up");
|
|
95
|
+
assert.equal(seenData, "vote:up");
|
|
96
|
+
});
|
|
97
|
+
test("lastBotMessage() stays in sync with editMessageText/editMessageReplyMarkup, even on an earlier reference", async () => {
|
|
98
|
+
const bot = new Composer()
|
|
99
|
+
.on("message:text", (ctx) => ctx.send("Pick:", {
|
|
100
|
+
reply_markup: { inline_keyboard: [[{ text: "Next", callback_data: "next" }]] },
|
|
101
|
+
}))
|
|
102
|
+
.callbackQuery("next", async (ctx) => {
|
|
103
|
+
const msg = ctx.callbackQuery.message;
|
|
104
|
+
await ctx.api.call("editMessageText", {
|
|
105
|
+
chat_id: msg.chat.id,
|
|
106
|
+
message_id: msg.message_id,
|
|
107
|
+
text: "Done!",
|
|
108
|
+
});
|
|
109
|
+
await ctx.api.call("editMessageReplyMarkup", {
|
|
110
|
+
chat_id: msg.chat.id,
|
|
111
|
+
message_id: msg.message_id,
|
|
112
|
+
reply_markup: { inline_keyboard: [[{ text: "Restart", callback_data: "restart" }]] },
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
const env = createTestEnv(bot);
|
|
116
|
+
const user = env.createUser();
|
|
117
|
+
await user.sendMessage("hi");
|
|
118
|
+
const bubble = env.lastBotMessage();
|
|
119
|
+
assert.ok(bubble);
|
|
120
|
+
assert.ok(bubble.reply_markup);
|
|
121
|
+
await user.on(bubble).clickByText("Next");
|
|
122
|
+
assert.equal(env.lastBotMessage(), bubble); // same reference
|
|
123
|
+
assert.equal(bubble.text, "Done!");
|
|
124
|
+
assert.equal((bubble.reply_markup?.inline_keyboard)[0]?.length, 1);
|
|
125
|
+
await user.on(bubble).clickByText("Restart");
|
|
126
|
+
});
|
|
127
|
+
test("lastBotMessage() query filters: chat, withReplyMarkup, where", async () => {
|
|
128
|
+
const bot = new Composer().on("message:text", (ctx) => {
|
|
129
|
+
if (ctx.text === "plain")
|
|
130
|
+
return ctx.reply("no markup");
|
|
131
|
+
return ctx.reply("with markup", {
|
|
132
|
+
reply_markup: { inline_keyboard: [[{ text: "x", callback_data: "x" }]] },
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
const env = createTestEnv(bot);
|
|
136
|
+
const user = env.createUser();
|
|
137
|
+
const group = env.createChat({ type: "group" });
|
|
138
|
+
await user.sendMessage("plain");
|
|
139
|
+
await user.sendMessage(group, "keyboard");
|
|
140
|
+
assert.equal(env.lastBotMessage({ chat: user.pmChat })?.text, "no markup");
|
|
141
|
+
assert.equal(env.lastBotMessage({ withReplyMarkup: true })?.chat.id, group.id);
|
|
142
|
+
assert.equal(env.lastBotMessage({
|
|
143
|
+
where: (call) => call.method === "sendMessage" && call.params?.chat_id === group.id,
|
|
144
|
+
})?.text, "with markup");
|
|
145
|
+
});
|
|
146
|
+
test("react() infers old_reaction from this user's last reaction on the message", async () => {
|
|
147
|
+
const seen = [];
|
|
148
|
+
const bot = new Composer().on("message_reaction", (ctx) => {
|
|
149
|
+
const r = ctx.update.message_reaction;
|
|
150
|
+
if (!r)
|
|
151
|
+
return;
|
|
152
|
+
seen.push({
|
|
153
|
+
old: r.old_reaction.map((x) => ("emoji" in x ? x.emoji : "")),
|
|
154
|
+
new: r.new_reaction.map((x) => ("emoji" in x ? x.emoji : "")),
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
const env = createTestEnv(bot);
|
|
158
|
+
const user = env.createUser();
|
|
159
|
+
const msg = await user.sendMessage("nice bot");
|
|
160
|
+
await user.react("👍", msg);
|
|
161
|
+
await user.react("❤", msg);
|
|
162
|
+
await user.react([], msg);
|
|
163
|
+
assert.deepEqual(seen[0], { old: [], new: ["👍"] });
|
|
164
|
+
assert.deepEqual(seen[1], { old: ["👍"], new: ["❤"] });
|
|
165
|
+
assert.deepEqual(seen[2], { old: ["❤"], new: [] });
|
|
166
|
+
});
|
|
167
|
+
test("join()/leave() track chat.members and dispatch chat_member + a service message", async () => {
|
|
168
|
+
const serviceMessages = [];
|
|
169
|
+
const bot = new Composer().on("message", (ctx) => {
|
|
170
|
+
if (ctx.message?.new_chat_members)
|
|
171
|
+
serviceMessages.push("joined");
|
|
172
|
+
if (ctx.message?.left_chat_member)
|
|
173
|
+
serviceMessages.push("left");
|
|
174
|
+
});
|
|
175
|
+
const env = createTestEnv(bot);
|
|
176
|
+
const user = env.createUser();
|
|
177
|
+
const group = env.createChat({ type: "group" });
|
|
178
|
+
await user.join(group);
|
|
179
|
+
assert.equal(group.members.has(user), true);
|
|
180
|
+
assert.equal(group.membershipOf(user)?.status, "member");
|
|
181
|
+
assert.deepEqual(serviceMessages, ["joined"]);
|
|
182
|
+
await user.leave(group);
|
|
183
|
+
assert.equal(group.members.has(user), false);
|
|
184
|
+
assert.equal(group.membershipOf(user)?.status, "left");
|
|
185
|
+
assert.deepEqual(serviceMessages, ["joined", "left"]);
|
|
186
|
+
});
|
|
187
|
+
test("sendInlineQuery / chooseInlineResult dispatch their updates", async () => {
|
|
188
|
+
let query;
|
|
189
|
+
let chosen;
|
|
190
|
+
const bot = new Composer()
|
|
191
|
+
.on("inline_query", (ctx) => {
|
|
192
|
+
query = ctx.update.inline_query?.query;
|
|
193
|
+
})
|
|
194
|
+
.on("chosen_inline_result", (ctx) => {
|
|
195
|
+
chosen = ctx.update.chosen_inline_result?.result_id;
|
|
196
|
+
});
|
|
197
|
+
const env = createTestEnv(bot);
|
|
198
|
+
const user = env.createUser();
|
|
199
|
+
const group = env.createChat({ type: "group" });
|
|
200
|
+
await user.sendInlineQuery("cats", group);
|
|
201
|
+
await user.chooseInlineResult("r1", "cats");
|
|
202
|
+
assert.equal(query, "cats");
|
|
203
|
+
assert.equal(chosen, "r1");
|
|
204
|
+
});
|
|
205
|
+
test("sendSuccessfulPayment throws unless the bot answered pre_checkout_query with ok: true", async () => {
|
|
206
|
+
const notHandling = createTestEnv(new Composer());
|
|
207
|
+
await assert.rejects(notHandling.createUser().sendSuccessfulPayment({ invoice_payload: "x" }), /never answered the pre_checkout_query/);
|
|
208
|
+
const rejecting = createTestEnv(new Composer().on("pre_checkout_query", async (ctx) => {
|
|
209
|
+
await ctx.api.call("answerPreCheckoutQuery", {
|
|
210
|
+
pre_checkout_query_id: ctx.update.pre_checkout_query?.id,
|
|
211
|
+
ok: false,
|
|
212
|
+
});
|
|
213
|
+
}));
|
|
214
|
+
await assert.rejects(rejecting.createUser().sendSuccessfulPayment({ invoice_payload: "x" }));
|
|
215
|
+
let paid;
|
|
216
|
+
const accepting = createTestEnv(new Composer()
|
|
217
|
+
.on("pre_checkout_query", async (ctx) => {
|
|
218
|
+
await ctx.api.call("answerPreCheckoutQuery", {
|
|
219
|
+
pre_checkout_query_id: ctx.update.pre_checkout_query?.id,
|
|
220
|
+
ok: true,
|
|
221
|
+
});
|
|
222
|
+
})
|
|
223
|
+
.on("message", (ctx) => {
|
|
224
|
+
paid = ctx.message?.successful_payment?.invoice_payload;
|
|
225
|
+
}));
|
|
226
|
+
await accepting.createUser().sendSuccessfulPayment({ invoice_payload: "sub_monthly" });
|
|
227
|
+
assert.equal(paid, "sub_monthly");
|
|
228
|
+
});
|
|
229
|
+
test("onApi/apiError let a test simulate a Telegram failure the bot must handle", async () => {
|
|
230
|
+
const bot = new Composer().on("message:text", async (ctx) => {
|
|
231
|
+
try {
|
|
232
|
+
await ctx.reply("hi");
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// swallow — this bot doesn't retry, just shouldn't crash the test
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
const env = createTestEnv(bot);
|
|
239
|
+
env.onApi("sendMessage", apiError(403, "Forbidden: bot was blocked by the user"));
|
|
240
|
+
await env.createUser().sendMessage("hi");
|
|
241
|
+
assert.equal(env.lastApiCall("sendMessage")?.error instanceof Error, true);
|
|
242
|
+
});
|
|
243
|
+
test("strictDispatch throws when no handler consumes the update", async () => {
|
|
244
|
+
const env = createTestEnv(new Composer(), { strictDispatch: true });
|
|
245
|
+
await assert.rejects(env.createUser().sendMessage("hi"), /no handler consumed/);
|
|
246
|
+
});
|
|
247
|
+
test("advanceTime() lets code under test skip a real setTimeout wait", async () => {
|
|
248
|
+
let resumed = false;
|
|
249
|
+
const bot = new Composer().on("message", () => {
|
|
250
|
+
setTimeout(() => {
|
|
251
|
+
resumed = true;
|
|
252
|
+
}, 5000);
|
|
253
|
+
});
|
|
254
|
+
const env = createTestEnv(bot);
|
|
255
|
+
env.useFakeTimers(); // arm before the handler schedules its setTimeout
|
|
256
|
+
await env.createUser().sendMessage("hi");
|
|
257
|
+
assert.equal(resumed, false);
|
|
258
|
+
await env.advanceTime(5000);
|
|
259
|
+
assert.equal(resumed, true);
|
|
260
|
+
env.shutdown();
|
|
261
|
+
});
|
|
262
|
+
test("chat.post() emits an anonymous channel_post and throws on non-channel chats", async () => {
|
|
263
|
+
let fromIsUndefined = false;
|
|
264
|
+
const bot = new Composer().on("channel_post", (ctx) => {
|
|
265
|
+
fromIsUndefined = ctx.update.channel_post?.from === undefined;
|
|
266
|
+
});
|
|
267
|
+
const env = createTestEnv(bot);
|
|
268
|
+
const channel = env.createChat({ type: "channel", title: "News" });
|
|
269
|
+
const group = env.createChat({ type: "group" });
|
|
270
|
+
await channel.post("breaking news");
|
|
271
|
+
assert.equal(fromIsUndefined, true);
|
|
272
|
+
await assert.rejects(group.post("nope"), /only channel chats can post/);
|
|
273
|
+
});
|
|
274
|
+
test("onPostDispatch hooks run after each dispatched update, in registration order", async () => {
|
|
275
|
+
const order = [];
|
|
276
|
+
const env = createTestEnv(new Composer());
|
|
277
|
+
env.onPostDispatch(() => {
|
|
278
|
+
order.push("first");
|
|
279
|
+
});
|
|
280
|
+
env.onPostDispatch(() => {
|
|
281
|
+
order.push("second");
|
|
282
|
+
});
|
|
283
|
+
await env.createUser().sendMessage("hi");
|
|
284
|
+
assert.deepEqual(order, ["first", "second"]);
|
|
285
|
+
});
|
|
286
|
+
test("packs: setup(env) runs at construction time and can seed api overrides", () => {
|
|
287
|
+
let ran = false;
|
|
288
|
+
const env = createTestEnv(new Composer(), {
|
|
289
|
+
packs: [
|
|
290
|
+
{
|
|
291
|
+
name: "probe",
|
|
292
|
+
setup(e) {
|
|
293
|
+
ran = true;
|
|
294
|
+
e.onApi("getMe", { id: 99, is_bot: true, first_name: "probe" });
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
});
|
|
299
|
+
assert.equal(ran, true);
|
|
300
|
+
return env.api.getMe().then((me) => assert.equal(me.id, 99));
|
|
301
|
+
});
|
|
302
|
+
//# sourceMappingURL=env.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env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,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC,CAAC"}
|
package/lib/fetch.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,wBAAsB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAS9F"}
|
package/lib/fetch.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** stub `globalThis.fetch` for the duration of `fn`, restoring the original afterwards (even on throw). */
|
|
2
|
+
export async function withFetch(handler, fn) {
|
|
3
|
+
const realFetch = globalThis.fetch;
|
|
4
|
+
globalThis.fetch = handler;
|
|
5
|
+
try {
|
|
6
|
+
return await fn();
|
|
7
|
+
}
|
|
8
|
+
finally {
|
|
9
|
+
globalThis.fetch = realFetch;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=fetch.js.map
|
package/lib/fetch.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,MAAM,CAAC,KAAK,UAAU,SAAS,CAAI,OAAqB,EAAE,EAAwB;IACjF,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC;IACnC,UAAU,CAAC,KAAK,GAAG,OAAO,CAAC;IAE3B,IAAI,CAAC;QACJ,OAAO,MAAM,EAAE,EAAE,CAAC;IACnB,CAAC;YAAS,CAAC;QACV,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;IAC9B,CAAC;AACF,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,209 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @yaebal/test —
|
|
3
|
-
* test runner or assertion library. Works with `node:test`, vitest, bun:test,
|
|
4
|
-
*
|
|
2
|
+
* @yaebal/test — an actor-driven test framework for yaebal bots, with zero dependency on any
|
|
3
|
+
* test runner or assertion library. Works with `node:test`, vitest, bun:test, jest, ava —
|
|
4
|
+
* anything that can `await` a promise and call `assert`.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* real
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** a single recorded api call: the method name and the params it was given. */
|
|
16
|
-
export interface RecordedCall {
|
|
17
|
-
method: string;
|
|
18
|
-
params: Record<string, unknown> | undefined;
|
|
19
|
-
}
|
|
20
|
-
/** a canned result for one method: a static value, an `Error` to throw, or a function of `(params, attempt)`. */
|
|
21
|
-
export type MockResult = unknown | Error | ((params: Record<string, unknown> | undefined, attempt: number) => unknown);
|
|
22
|
-
export interface MockApiOptions {
|
|
23
|
-
/**
|
|
24
|
-
* per-method canned results/errors, keyed by method name — overrides the
|
|
25
|
-
* built-in defaults. a function receives `attempt`, a 1-based count of how
|
|
26
|
-
* many times that method has been called (including retries), so you can
|
|
27
|
-
* simulate "fails twice, then succeeds": `sendMessage: (p, a) => a <= 2 ? new
|
|
28
|
-
* TelegramError(...) : { message_id: 1 }`.
|
|
29
|
-
*/
|
|
30
|
-
results?: Record<string, MockResult>;
|
|
31
|
-
}
|
|
32
|
-
/** result of {@link mockApi}: the fake `api`, its recorded calls, and inspection helpers. */
|
|
33
|
-
export interface MockApi {
|
|
34
|
-
api: Api;
|
|
35
|
-
calls: RecordedCall[];
|
|
36
|
-
/** hooks registered on `api` via `before`/`after`/`onError` — inspect them or invoke them yourself. */
|
|
37
|
-
hooks: {
|
|
38
|
-
before: BeforeHook[];
|
|
39
|
-
after: AfterHook[];
|
|
40
|
-
onError: ErrorHook[];
|
|
41
|
-
};
|
|
42
|
-
/** the most recent recorded call, optionally filtered to a method. */
|
|
43
|
-
lastCall(method?: string): RecordedCall | undefined;
|
|
44
|
-
/** every recorded call to a given method, in call order. */
|
|
45
|
-
callsTo(method: string): RecordedCall[];
|
|
46
|
-
/** set (or replace) the canned result/error for a method after creation. */
|
|
47
|
-
setResult(method: string, result: MockResult): void;
|
|
48
|
-
/** clear recorded calls and per-method attempt counters. keeps hooks and result overrides. */
|
|
49
|
-
reset(): void;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* a fake {@link Api} whose every method records `{ method, params }` into `calls`
|
|
53
|
-
* and resolves to a sensible default (auto-incrementing `message_id` for `send*`,
|
|
54
|
-
* `true` for `answerCallbackQuery`, `{}` otherwise) — or to whatever `options.results`
|
|
55
|
-
* says. `before`/`after`/`onError` are real hook registrars (not no-ops): register
|
|
56
|
-
* a hook the same way you would on the production `Api` and it actually runs,
|
|
57
|
-
* including retries requested by an `onError` hook. the mock never actually waits
|
|
58
|
-
* on a requested `delayMs` — retries settle instantly, so tests stay fast.
|
|
59
|
-
*/
|
|
60
|
-
export declare function mockApi(options?: MockApiOptions): MockApi;
|
|
61
|
-
/** build an {@link Update} from a partial, filling in a fresh `update_id`. */
|
|
62
|
-
export declare function createUpdate(partial?: Partial<Update>): Update;
|
|
63
|
-
/** options shared by the message-shaped factories (`message`, `edited_message`, `channel_post`, ...). */
|
|
64
|
-
export interface MessageUpdateOptions {
|
|
65
|
-
text?: string;
|
|
66
|
-
chatId?: number;
|
|
67
|
-
fromId?: number;
|
|
68
|
-
chatType?: "private" | "group" | "supergroup" | "channel";
|
|
69
|
-
}
|
|
70
|
-
/** build a `message` {@link Update}. */
|
|
71
|
-
export declare function messageUpdate(options?: MessageUpdateOptions): Update;
|
|
72
|
-
/** build an `edited_message` {@link Update}. */
|
|
73
|
-
export declare function editedMessageUpdate(options?: MessageUpdateOptions): Update;
|
|
74
|
-
/** build a `channel_post` {@link Update}. */
|
|
75
|
-
export declare function channelPostUpdate(options?: MessageUpdateOptions): Update;
|
|
76
|
-
/** build an `edited_channel_post` {@link Update}. */
|
|
77
|
-
export declare function editedChannelPostUpdate(options?: MessageUpdateOptions): Update;
|
|
78
|
-
/** options for {@link callbackUpdate}. */
|
|
79
|
-
export interface CallbackUpdateOptions {
|
|
80
|
-
data?: string;
|
|
81
|
-
chatId?: number;
|
|
82
|
-
fromId?: number;
|
|
83
|
-
}
|
|
84
|
-
/** build a `callback_query` {@link Update}. */
|
|
85
|
-
export declare function callbackUpdate(options?: CallbackUpdateOptions): Update;
|
|
86
|
-
/** options for {@link inlineQueryUpdate}. */
|
|
87
|
-
export interface InlineQueryUpdateOptions {
|
|
88
|
-
query?: string;
|
|
89
|
-
fromId?: number;
|
|
90
|
-
id?: string;
|
|
91
|
-
offset?: string;
|
|
92
|
-
chatType?: Payload<"inline_query">["chat_type"];
|
|
93
|
-
}
|
|
94
|
-
/** build an `inline_query` {@link Update}. */
|
|
95
|
-
export declare function inlineQueryUpdate(options?: InlineQueryUpdateOptions): Update;
|
|
96
|
-
/** options for {@link chosenInlineResultUpdate}. */
|
|
97
|
-
export interface ChosenInlineResultUpdateOptions {
|
|
98
|
-
resultId?: string;
|
|
99
|
-
fromId?: number;
|
|
100
|
-
query?: string;
|
|
101
|
-
inlineMessageId?: string;
|
|
102
|
-
}
|
|
103
|
-
/** build a `chosen_inline_result` {@link Update}. */
|
|
104
|
-
export declare function chosenInlineResultUpdate(options?: ChosenInlineResultUpdateOptions): Update;
|
|
105
|
-
/** options for {@link shippingQueryUpdate}. */
|
|
106
|
-
export interface ShippingQueryUpdateOptions {
|
|
107
|
-
id?: string;
|
|
108
|
-
fromId?: number;
|
|
109
|
-
invoicePayload?: string;
|
|
110
|
-
shippingAddress?: Partial<Payload<"shipping_query">["shipping_address"]>;
|
|
111
|
-
}
|
|
112
|
-
/** build a `shipping_query` {@link Update}. */
|
|
113
|
-
export declare function shippingQueryUpdate(options?: ShippingQueryUpdateOptions): Update;
|
|
114
|
-
/** options for {@link preCheckoutQueryUpdate}. */
|
|
115
|
-
export interface PreCheckoutQueryUpdateOptions {
|
|
116
|
-
id?: string;
|
|
117
|
-
fromId?: number;
|
|
118
|
-
currency?: string;
|
|
119
|
-
totalAmount?: number;
|
|
120
|
-
invoicePayload?: string;
|
|
121
|
-
}
|
|
122
|
-
/** build a `pre_checkout_query` {@link Update}. */
|
|
123
|
-
export declare function preCheckoutQueryUpdate(options?: PreCheckoutQueryUpdateOptions): Update;
|
|
124
|
-
/** options for {@link pollUpdate}. */
|
|
125
|
-
export interface PollUpdateOptions {
|
|
126
|
-
id?: string;
|
|
127
|
-
question?: string;
|
|
128
|
-
options?: string[];
|
|
129
|
-
isClosed?: boolean;
|
|
130
|
-
}
|
|
131
|
-
/** build a `poll` {@link Update}. */
|
|
132
|
-
export declare function pollUpdate(options?: PollUpdateOptions): Update;
|
|
133
|
-
/** options for {@link pollAnswerUpdate}. */
|
|
134
|
-
export interface PollAnswerUpdateOptions {
|
|
135
|
-
pollId?: string;
|
|
136
|
-
fromId?: number;
|
|
137
|
-
optionIds?: number[];
|
|
138
|
-
}
|
|
139
|
-
/** build a `poll_answer` {@link Update}. */
|
|
140
|
-
export declare function pollAnswerUpdate(options?: PollAnswerUpdateOptions): Update;
|
|
141
|
-
/** options for {@link myChatMemberUpdate} / {@link chatMemberUpdate}. */
|
|
142
|
-
export interface ChatMemberUpdateOptions {
|
|
143
|
-
chatId?: number;
|
|
144
|
-
fromId?: number;
|
|
145
|
-
userId?: number;
|
|
146
|
-
oldStatus?: string;
|
|
147
|
-
newStatus?: string;
|
|
148
|
-
}
|
|
149
|
-
/** build a `my_chat_member` {@link Update} (the bot's own membership changed). */
|
|
150
|
-
export declare function myChatMemberUpdate(options?: ChatMemberUpdateOptions): Update;
|
|
151
|
-
/** build a `chat_member` {@link Update} (another member's membership changed). */
|
|
152
|
-
export declare function chatMemberUpdate(options?: ChatMemberUpdateOptions): Update;
|
|
153
|
-
/** options for {@link chatJoinRequestUpdate}. */
|
|
154
|
-
export interface ChatJoinRequestUpdateOptions {
|
|
155
|
-
chatId?: number;
|
|
156
|
-
fromId?: number;
|
|
157
|
-
userChatId?: number;
|
|
158
|
-
bio?: string;
|
|
159
|
-
}
|
|
160
|
-
/** build a `chat_join_request` {@link Update}. */
|
|
161
|
-
export declare function chatJoinRequestUpdate(options?: ChatJoinRequestUpdateOptions): Update;
|
|
162
|
-
/** infer which payload key an update carries; defaults to `"message"`. */
|
|
163
|
-
export declare function detectUpdateType(update: Update): UpdateName;
|
|
164
|
-
/**
|
|
165
|
-
* wrap an {@link Update} in a core {@link Context}. the api defaults to a fresh
|
|
166
|
-
* {@link mockApi}; pass `updateType` to override the auto-detected one.
|
|
167
|
-
*/
|
|
168
|
-
export declare function createContext(update: Update, api?: Api, updateType?: UpdateName): Context;
|
|
169
|
-
/** shortcut: build a `message` update and wrap it in a {@link Context} in one call. */
|
|
170
|
-
export declare function messageContext(options?: MessageUpdateOptions, api?: Api): Context;
|
|
171
|
-
/** shortcut: build a `callback_query` update and wrap it in a {@link Context} in one call. */
|
|
172
|
-
export declare function callbackContext(options?: CallbackUpdateOptions, api?: Api): Context;
|
|
173
|
-
/** run a composer's middleware against a context. resolves when the chain settles. */
|
|
174
|
-
export declare function runMiddleware<C extends Context>(composer: Composer<C>, ctx: C): Promise<void>;
|
|
175
|
-
/** an inline keyboard button found by {@link findButton}, with its position. */
|
|
176
|
-
export interface FoundButton {
|
|
177
|
-
text: string;
|
|
178
|
-
row: number;
|
|
179
|
-
col: number;
|
|
180
|
-
[key: string]: unknown;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* search an inline keyboard (a `reply_markup`-shaped object, e.g. from a
|
|
184
|
-
* recorded `sendMessage` call's params) for a button whose text matches a
|
|
185
|
-
* string or regex. returns the button (plus its `row`/`col`) or `undefined`.
|
|
6
|
+
* {@link createTestEnv} wraps your bot and hands you {@link UserActor}/{@link ChatActor} actors
|
|
7
|
+
* that send it real updates — messages, commands, media, reactions, button clicks, joins,
|
|
8
|
+
* payments — the way real Telegram users would. every outgoing api call is intercepted and
|
|
9
|
+
* recorded (no real HTTP), with sensible auto-stubs, `onApi`/`apiError` overrides for the rest,
|
|
10
|
+
* a virtual clock for TTL/retry tests, and satellite-plugin test packs.
|
|
11
|
+
*
|
|
12
|
+
* fixture builders ({@link messageUpdate} & co.), {@link webhookRequest}/{@link collectUpdates},
|
|
13
|
+
* and {@link withFetch} remain as the escape hatch beneath the actor api — reach for them when
|
|
14
|
+
* you need a raw update shape or full control.
|
|
186
15
|
*/
|
|
187
|
-
export
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
export
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
/** a minimal {@link UpdateSink} (the `{ handleUpdate }` shape `webhookCallback`/runners expect) that just records. */
|
|
196
|
-
export declare function collectUpdates(): UpdateCollector;
|
|
197
|
-
/** options for {@link webhookRequest}. */
|
|
198
|
-
export interface WebhookRequestOptions {
|
|
199
|
-
url?: string;
|
|
200
|
-
method?: string;
|
|
201
|
-
secretToken?: string;
|
|
202
|
-
headers?: Record<string, string>;
|
|
203
|
-
}
|
|
204
|
-
/** build a `Request` carrying `update` as JSON, as telegram would POST it to a webhook handler. */
|
|
205
|
-
export declare function webhookRequest(update: Update, options?: WebhookRequestOptions): Request;
|
|
206
|
-
/** stub `globalThis.fetch` for the duration of `fn`, restoring the original afterwards (even on throw). */
|
|
207
|
-
export declare function withFetch<T>(handler: typeof fetch, fn: () => T | Promise<T>): Promise<T>;
|
|
208
|
-
export type { Message };
|
|
16
|
+
export { type MockApi, type MockApiOptions, mockApi } from "./api.js";
|
|
17
|
+
export { type ApiErrorSentinel, apiError, type BotMessage, ChatActor, type ChatMembership, type ChatType, type CreateChatOptions, createTestEnv, installTestClock, isApiErrorSentinel, type LastBotMessageQuery, type MediaOptions, type MessageOptions, type MockResult, type OnApiOptions, type RecordedCall, TestApiError, type TestClock, TestEnv, type TestEnvOptions, type TestPack, UserActor, UserInChatScope, UserOnMessageScope, } from "./env.js";
|
|
18
|
+
export { withFetch } from "./fetch.js";
|
|
19
|
+
export { type FoundButton, findButton } from "./keyboard.js";
|
|
20
|
+
export { toPlain } from "./normalize.js";
|
|
21
|
+
export { type BuildUserOptions, buildUser, type CallbackUpdateOptions, type ChatJoinRequestUpdateOptions, type ChatMemberUpdateOptions, type ChosenInlineResultUpdateOptions, callbackUpdate, channelPostUpdate, chatJoinRequestUpdate, chatMemberUpdate, chosenInlineResultUpdate, createUpdate, detectUpdateType, editedChannelPostUpdate, editedMessageUpdate, type InlineQueryUpdateOptions, inlineQueryUpdate, type MessageUpdateOptions, messageUpdate, myChatMemberUpdate, type PollAnswerUpdateOptions, type PollUpdateOptions, type PreCheckoutQueryUpdateOptions, pollAnswerUpdate, pollUpdate, preCheckoutQueryUpdate, type ShippingQueryUpdateOptions, shippingQueryUpdate, } from "./updates.js";
|
|
22
|
+
export { collectUpdates, type UpdateCollector, type WebhookRequestOptions, webhookRequest, } from "./webhook.js";
|
|
209
23
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EACN,KAAK,gBAAgB,EACrB,QAAQ,EACR,KAAK,UAAU,EACf,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK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