@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, 04:45 UTC

main
ts 25 lines 1.11 KB
Raw
1 import { ApiDiffError, isApiDiffError } from "@effect/api-diff/Error"
2 import { isSnapshotExtractionError, SnapshotExtractionError } from "@effect/api-diff/Snapshot"
3 import { assert, describe, it } from "@effect/vitest"
4 import { vi } from "vitest"
5 import type * as ApiDiffErrorModule from "../src/Error.ts"
6 import type * as SnapshotModule from "../src/Snapshot.ts"
7
8 describe("tagged errors", () => {
9 it("recognizes errors from a reloaded module copy", async () => {
10 vi.resetModules()
11 const ForeignApiDiffError = await vi.importActual<typeof ApiDiffErrorModule>("../src/Error.ts")
12 const ForeignSnapshot = await vi.importActual<typeof SnapshotModule>("../src/Snapshot.ts")
13
14 const apiDiffError = new ForeignApiDiffError.ApiDiffError({ message: "boom" })
15 assert.isFalse(apiDiffError instanceof ApiDiffError)
16 assert.isTrue(isApiDiffError(apiDiffError))
17
18 const snapshotError = new ForeignSnapshot.SnapshotExtractionError({
19 message: "boom",
20 diagnostics: []
21 })
22 assert.isFalse(snapshotError instanceof SnapshotExtractionError)
23 assert.isTrue(isSnapshotExtractionError(snapshotError))
24 })
25 })