@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

main
ts 32 lines 1.03 KB
Raw
1 import * as Schema from "effect/Schema";
2 import { describe, expect, it } from "vite-plus/test";
3
4 import { parseT3ProjectFile, T3ProjectFileFromJson } from "./t3ProjectFile.ts";
5
6 const decodeJson = Schema.decodeUnknownSync(T3ProjectFileFromJson);
7
8 describe("T3ProjectFileFromJson", () => {
9 it("decodes lenient JSONC with comments and trailing commas", () => {
10 const decoded = decodeJson(`{
11 // team scripts
12 "iconPath": "assets/logo.svg",
13 "scripts": [
14 { "name": "Dev", "command": "pnpm dev", "stopOnSettle": true, },
15 ],
16 }`);
17
18 expect(decoded.iconPath).toBe("assets/logo.svg");
19 expect(decoded.scripts?.[0]).toEqual({ name: "Dev", command: "pnpm dev", stopOnSettle: true });
20 });
21 });
22
23 describe("parseT3ProjectFile", () => {
24 it("reads project defaults from JSONC with a URL in a block comment", () => {
25 expect(
26 parseT3ProjectFile(`{
27 /* See https://t3.codes/schema/t3.json */
28 "defaultThreadEnvMode": "worktree"
29 }`),
30 ).toEqual({ defaultThreadEnvMode: "worktree" });
31 });
32 });