Personal Telegram developer console for GitHub
test: keep public status endpoint minimal
davoodmehraban89 committed
Oct 4, 2026 at 14:14 UTC
38c9b8974e9dc443d6cd23ea331066ca32e4d0d2
1 file changed
+8
-10
test/index.test.js
+8
-10
@@ -41,18 +41,16 @@ describe('Nexa Dev Bot - Cloudflare Worker Entrypoint', () => {
41
assert.equal('uptime' in body, false);
42
});
43
44
- it('GET /status returns the operational status payload without requiring an external network call', async () => {
45
- const res = await worker.fetch(new Request('https://example.test/status', { method: 'GET' }), {
46
- ...runtime,
47
- GITHUB_TOKEN: ''
48
- });
44
+ it('GET /status stays public-minimal and does not expose owner-only operational diagnostics', async () => {
45
+ const res = await worker.fetch(new Request('https://example.test/status', { method: 'GET' }), runtime);
46
assert.equal(res.status, 200);
47
const body = await res.json();
51
- assert.ok(body.text.includes('وضعیت زنده Nexa Dev'));
52
- assert.ok(body.text.includes('GitHub live READ'));
53
- assert.ok(body.text.includes('WORKSPACE_STORE'));
54
- assert.ok(body.reply_markup);
55
- assert.doesNotMatch(body.text, /100% SLA|ms latency/i);
48
+ assert.deepEqual(Object.keys(body).sort(), ['bot', 'mode', 'status', 'version']);
49
+ assert.equal(body.status, 'online');
50
+ const serialized = JSON.stringify(body);
51
+ for (const privateDetail of ['WORKSPACE_STORE', 'APPROVAL_REPLAY_GUARD', 'GitHub live READ', 'credential', 'configured']) {
52
+ assert.ok(!serialized.includes(privateDetail), `public status leaked ${privateDetail}`);
53
+ }
54
});
55
56
it('authorized Telegram webhook processes /start', async () => {