Personal Telegram developer console for GitHub
test: remove obsolete diagnostics test
davoodmehraban89 committed
Oct 2, 2026 at 19:06 UTC
894eda64160a218a28cb0444d290e14476d16def
1 file changed
-36
test/diag.test.js
deleted
-36
@@ -1,36 +0,0 @@
1
-import test from "node:test";
2
-import assert from "node:assert/strict";
3
-import worker from "../src/index.js";
4
-
5
-test("/diag replies with sender id and authorization state before owner gate", async () => {
6
- const req = new Request("https://example.com/telegram/webhook", {
7
- method: "POST",
8
- headers: {
9
- "content-type": "application/json",
10
- "X-Telegram-Bot-Api-Secret-Token": "right",
11
- },
12
- body: JSON.stringify({
13
- message: { text: "/diag", from: { id: 999 }, chat: { id: 999 } },
14
- }),
15
- });
16
-
17
- let sent;
18
- globalThis.fetch = async (url, init) => {
19
- sent = { url: String(url), body: JSON.parse(init.body) };
20
- return new Response(JSON.stringify({ ok: true }), {
21
- status: 200,
22
- headers: { "content-type": "application/json" },
23
- });
24
- };
25
-
26
- const res = await worker.fetch(req, {
27
- TELEGRAM_WEBHOOK_SECRET: "right",
28
- OWNER_TELEGRAM_ID: "123",
29
- TELEGRAM_BOT_TOKEN: "token",
30
- });
31
-
32
- assert.equal(res.status, 200);
33
- assert.equal(sent.url, "https://api.telegram.org/bottoken/sendMessage");
34
- assert.match(sent.body.text, /999/);
35
- assert.match(sent.body.text, /unauthorized/i);
36
-});