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

service.test.ts

37 lines1.1 KB

1import { assert, it } from "@effect/vitest";
2​
3import { formatServiceStatus } from "./service.ts";
4​
5const status = {
6 supported: true,
7 installed: true,
8 current: true,
9 unitPath: "/home/me/.config/systemd/user/t3code.service",
10 logPath: "/home/me/.t3/userdata/logs/boot-service.log",
11} as const;
12​
13it("reports the installed service version and host paths", () => {
14 assert.equal(
15 formatServiceStatus(status, "0.0.29"),
16 [
17 "T3 Code service",
18 " Status: installed · t3@0.0.29",
19 " Unit: /home/me/.config/systemd/user/t3code.service",
20 " Logs: /home/me/.t3/userdata/logs/boot-service.log",
21 ].join("\n"),
22 );
23});
24​
25it("gives a direct repair command for a stale service", () => {
26 assert.include(
27 formatServiceStatus({ ...status, current: false }, "0.0.29"),
28 "Next: Run `npx t3@latest service update`.",
29 );
30});
31​
32it("explains where the service is supported", () => {
33 assert.include(
34 formatServiceStatus({ ...status, supported: false, installed: false }, "0.0.29"),
35 "Supported on: Linux with systemd, macOS with launchd",
36 );
37});