Files
t3code/apps/server/src/cloud/servicePreflight.test.ts
T

34 lines
901 B
TypeScript

import { expect, it } from "@effect/vitest";
import { runServicePreflight } from "./servicePreflight.ts";
import { SERVICE_LAUNCHER_PROTOCOL } from "./serviceProtocol.ts";
it.each([1, 2])("blocks legacy launcher protocol %i", (launcherProtocol) => {
expect(
runServicePreflight({
databasePath: "/missing/state.sqlite",
launcherProtocol,
version: "1.2.3",
}),
).toEqual({
status: "blocked",
version: "1.2.3",
reason:
"This release requires a newer T3 Code service launcher. Update it on the server machine.",
});
});
it("accepts the current launcher protocol", () => {
expect(
runServicePreflight({
databasePath: "/missing/state.sqlite",
launcherProtocol: SERVICE_LAUNCHER_PROTOCOL,
version: "1.2.3",
}),
).toEqual({
status: "ready",
version: "1.2.3",
launcherProtocol: SERVICE_LAUNCHER_PROTOCOL,
});
});