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, 04:45 UTC
| 1 | import { describe, expect, it } from "@alchemy.run/test"; |
| 2 | import { formatResourceTag, stripChildEffectPrefix } from "@/Util/ResourceOutput.ts"; |
| 3 | |
| 4 | describe("stripChildEffectPrefix", { tags: ["unit", "local"] }, () => { |
| 5 | it("removes an Effect pretty prefix", () => { |
| 6 | expect( |
| 7 | stripChildEffectPrefix("[14:49:25.594] INFO (#1836): Cloudflare Worker reconcile: starting"), |
| 8 | ).toBe("Cloudflare Worker reconcile: starting"); |
| 9 | }); |
| 10 | |
| 11 | it("removes a colored prefix without stripping message color", () => { |
| 12 | expect( |
| 13 | stripChildEffectPrefix( |
| 14 | "\x1b[37m[14:49:25.594]\x1b[0m \x1b[32mINFO\x1b[0m (#1836): \x1b[36mmessage\x1b[0m", |
| 15 | ), |
| 16 | ).toBe("\x1b[36mmessage\x1b[0m"); |
| 17 | }); |
| 18 | |
| 19 | it("leaves ordinary child output unchanged", () => { |
| 20 | expect(stripChildEffectPrefix("vite building for production...")).toBe( |
| 21 | "vite building for production...", |
| 22 | ); |
| 23 | }); |
| 24 | }); |
| 25 | |
| 26 | describe("formatResourceTag", { tags: ["unit", "local"] }, () => { |
| 27 | it("uses the Sigil info color when colors are enabled", () => { |
| 28 | expect(formatResourceTag("Site/Worker", true)).toMatch( |
| 29 | /^\x1b\[38;2;\d+;\d+;\d+m\[Site\/Worker\]\x1b\[0m$/, |
| 30 | ); |
| 31 | }); |
| 32 | |
| 33 | it("stays parseable when colors are disabled", () => { |
| 34 | expect(formatResourceTag("Site/Worker", false)).toBe("[Site/Worker]"); |
| 35 | }); |
| 36 | }); |