1import { expect, it } from "@effect/vitest";
2
3import { runServicePreflight } from "./servicePreflight.ts";
4import { SERVICE_LAUNCHER_PROTOCOL } from "./serviceProtocol.ts";
5
6it.each([1, 2])("blocks legacy launcher protocol %i", (launcherProtocol) => {
7 expect(
8 runServicePreflight({
9 databasePath: "/missing/state.sqlite",
10 launcherProtocol,
11 version: "1.2.3",
12 }),
13 ).toEqual({
14 status: "blocked",
15 version: "1.2.3",
16 reason:
17 "This release requires a newer T3 Code service launcher. Update it on the server machine.",
18 });
19});
20
21it("accepts the current launcher protocol", () => {
22 expect(
23 runServicePreflight({
24 databasePath: "/missing/state.sqlite",
25 launcherProtocol: SERVICE_LAUNCHER_PROTOCOL,
26 version: "1.2.3",
27 }),
28 ).toEqual({
29 status: "ready",
30 version: "1.2.3",
31 launcherProtocol: SERVICE_LAUNCHER_PROTOCOL,
32 });
33});