import assert from "node:assert/strict" import { readFile } from "node:fs/promises" import test from "node:test" const presentationPath = new URL("../shared/utils/presentation.ts", import.meta.url) const timeoutsPath = new URL("../shared/config/timeouts.ts", import.meta.url) const clientPath = new URL("../shared/api/client.ts", import.meta.url) const bridgePath = new URL("../shared/api/astrbot-page-bridge.ts", import.meta.url) const appPath = new URL("../standalone-web/src/App.vue", import.meta.url) test("uses the backend 900 second task budget throughout the plugin bridge UI", async () => { const [timeouts, client, bridge, app] = await Promise.all([ readFile(timeoutsPath, "utf8"), readFile(clientPath, "utf8"), readFile(bridgePath, "utf8"), readFile(appPath, "utf8"), ]) assert.match(timeouts, /LONG_TASK_TIMEOUT_SECONDS = 900/) assert.match(timeouts, /LONG_TASK_TIMEOUT_MS = LONG_TASK_TIMEOUT_SECONDS \* 1000/) assert.match(client, /LONG_TASK_ENDPOINT\.test\(endpoint\)[\s\S]*\? LONG_TASK_TIMEOUT_MS/) assert.match(bridge, /LONG_TASK_ENDPOINT\.test\(endpoint\)[\s\S]*\? LONG_TASK_TIMEOUT_MS/) assert.match(app, /耗时 \/ 后端时限/) }) test("treats naive backend timestamps as UTC and freezes terminal job duration", async () => { const presentation = await readFile(presentationPath, "utf8") assert.match(presentation, /BACKEND_NAIVE_UTC_TIMESTAMP/) assert.match(presentation, /`\$\{text\.replace\(" ", "T"\)\}Z`/) assert.match(presentation, /TERMINAL_JOB_STATUSES\.has\(status\)/) assert.match(presentation, /terminal \? timestamp\(job\.updated_at\) : 0/) assert.match(presentation, /job\.request\?\.timeout_seconds/) })