Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

servicePreflight.test.ts

22 lines1.0 KB

1import { expect, it } from "@effect/vitest";
2​
3import { runServicePreflight } from "./servicePreflight.ts";
4import { SERVICE_LAUNCHER_PROTOCOL } from "./serviceProtocol.ts";
5​
6// regression: #13239 a stale CLI shadowing the updated one kept "updating" to itself
7it.each([1])("blocks legacy launcher protocol %i with exact recovery steps", (launcherProtocol) => {
8 const result = runServicePreflight({
9 databasePath: "/missing/state.sqlite",
10 launcherProtocol,
11 version: "9.8.7",
12 });
13​
14 expect(result).toMatchObject({ status: "blocked", version: "9.8.7" });
15 const reason = result.status === "blocked" ? result.reason : "";
16 expect(reason).toMatch(new RegExp(`\\b${launcherProtocol}\\b`));
17 expect(reason).toMatch(new RegExp(`\\b${SERVICE_LAUNCHER_PROTOCOL}\\b`));
18 expect(reason).toContain("curl -fsSL https://t3.codes/install.sh | T3CODE_VERSION=9.8.7 sh");
19 expect(reason).toContain("~/.local/bin/t3 service install");
20 expect(reason).toContain("t3 --version");
21 expect(reason).toContain("which -a t3");
22});