返回 DeepSeek-Reasonix
smoke-poll.test.mjs
根目录 / desktop / packaging / smoke-poll.test.mjs
1 import assert from "node:assert/strict";
2 import { test } from "node:test";
3 import { parseServiceReady, waitForSmokeCondition } from "./smoke-poll.mjs";
4
5 test("packaged smoke recognises the stable ready prefix with appended build fields", () => {
6 assert.deepEqual(
7 parseServiceReady("info desktop service ready: generation g-test, pid 42, version=v1 channel=canary commit=abc"),
8 { generation: "g-test", pid: 42, line: "desktop service ready: generation g-test, pid 42" },
9 );
10 });
11
12 test("packaged smoke rejects incompatible ready delimiters", () => {
13 assert.equal(parseServiceReady("desktop service ready: generation=g-test pid=42"), null);
14 });
15
16 test("async false does not complete a packaged RPC condition", async () => {
17 let attempts = 0;
18 await waitForSmokeCondition(async () => ++attempts === 3, { interval: 0 });
19 assert.equal(attempts, 3);
20 });
21
22 test("a persistently false RPC result fails instead of advancing the smoke", async () => {
23 await assert.rejects(waitForSmokeCondition(async () => false, { timeout: 0 }), /Timed out/);
24 });
25
26 test("RPC failures remain visible", async () => {
27 await assert.rejects(waitForSmokeCondition(async () => { throw new Error("host unavailable"); }), /host unavailable/);
28 });
29
29 lines Plain Text