29 lines
914 B
TypeScript
29 lines
914 B
TypeScript
import { mkdtempSync, rmSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
|
|
import { expect, test } from "bun:test";
|
|
|
|
import { workbenchNativeServicesStatus } from "./workbench-native-service.ts";
|
|
|
|
test("aggregates all Workbench native service states in one query", async () => {
|
|
const cwd = mkdtempSync(join(tmpdir(), "hwlab-workbench-status-"));
|
|
try {
|
|
const result = await workbenchNativeServicesStatus({
|
|
cwd,
|
|
env: { WORKBENCH_NATIVE_SERVICE_STATE_DIR: ".state/services" }
|
|
});
|
|
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
operation: "workbench.service.status",
|
|
status: "stopped",
|
|
summary: { total: 3, running: 0, unavailable: 3 },
|
|
valuesPrinted: false
|
|
});
|
|
expect(Object.keys(result.services).sort()).toEqual(["api", "web", "worker"]);
|
|
} finally {
|
|
rmSync(cwd, { recursive: true, force: true });
|
|
}
|
|
});
|