Personal Telegram developer console for GitHub
test: require visible feedback for Advanced READ provider errors
davoodmehraban89 committed
Oct 3, 2026 at 09:25 UTC
14b8c4c81b3e666d8b65d84079ee5eaa329e3292
1 file changed
+34
test/github-advanced-read-error-ui.test.js
new
+34
@@ -0,0 +1,34 @@
1
+import test from 'node:test';
2
+import assert from 'node:assert/strict';
3
+import { NexaDevBot } from '../src/bot.js';
4
+
5
+test('Advanced READ provider failures visibly update Telegram instead of appearing silent', async () => {
6
+ const bot = new NexaDevBot({
7
+ TELEGRAM_BOT_TOKEN: 'telegram-test-token',
8
+ TELEGRAM_WEBHOOK_SECRET: 'webhook-test-secret',
9
+ GITHUB_TOKEN: 'github-test-token'
10
+ });
11
+ const edits = [];
12
+ bot.telegram.answerCallbackQuery = async () => ({ ok: true });
13
+ bot.telegram.editMessageText = async (chatId, messageId, text, replyMarkup) => {
14
+ edits.push({ chatId, messageId, text, replyMarkup });
15
+ return { ok: true };
16
+ };
17
+ bot.router.dispatchCallback = async () => {
18
+ throw new Error('GitHub check runs failed: 403 Resource not accessible by personal access token');
19
+ };
20
+
21
+ const result = await bot.handleCallbackQuery({
22
+ id: 'cb-read-error',
23
+ data: 'prchecks:123:19:1',
24
+ from: { id: 42 },
25
+ message: { chat: { id: 42 }, message_id: 99 }
26
+ });
27
+
28
+ assert.equal(result.ok, false);
29
+ assert.equal(result.edited, true);
30
+ assert.equal(edits.length, 1);
31
+ assert.match(edits[0].text, /دریافت اطلاعات|خطا/);
32
+ assert.match(edits[0].text, /مجوز|دسترسی/);
33
+ assert.doesNotMatch(edits[0].text, /github-test-token|telegram-test-token|webhook-test-secret/);
34
+});