mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import assert from "node:assert/strict";
|
|||
|
|
import { describe, it } from "node:test";
|
||
|
|
|
||
|
|
import {
|
||
|
|
DAEMON_STARTUP_TIMEOUT_MS,
|
||
|
|
waitForDaemonRuntime,
|
||
|
|
waitForDesktopRuntime,
|
||
|
|
waitForWebRuntime,
|
||
|
|
} from "../src/sidecar-client.js";
|
||
|
|
|
||
|
|
describe("sidecar startup waits", () => {
|
||
|
|
it("allows daemon initialization to continue past the legacy 35 second deadline", () => {
|
||
|
|
assert.equal(DAEMON_STARTUP_TIMEOUT_MS, 120_000);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("fails immediately when a spawned app exits before publishing status", async () => {
|
||
|
|
const waits = [
|
||
|
|
["daemon", waitForDaemonRuntime],
|
||
|
|
["web", waitForWebRuntime],
|
||
|
|
["desktop", waitForDesktopRuntime],
|
||
|
|
] as const;
|
||
|
|
|
||
|
|
for (const [appName, waitForRuntime] of waits) {
|
||
|
|
const startedAt = Date.now();
|
||
|
|
await assert.rejects(
|
||
|
|
waitForRuntime(
|
||
|
|
{ base: "unused", namespace: `exited-${appName}-${process.pid}` },
|
||
|
|
5_000,
|
||
|
|
() => false,
|
||
|
|
),
|
||
|
|
new RegExp(`${appName} exited before exposing status`),
|
||
|
|
);
|
||
|
|
assert.ok(Date.now() - startedAt < 1_000);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|