@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 29 lines 1.07 KB
Raw
1 import * as Config from "@effect/graphql-generator/Config"
2 import { assert, describe, it } from "@effect/vitest"
3 import * as Exit from "effect/Exit"
4 import * as Schema from "effect/Schema"
5
6 const example = {
7 schema: "./schema/github.graphql",
8 documents: ["src/**/*.graphql"],
9 scalars: {
10 DateTime: "effect/Schema#DateTimeUtcFromString",
11 URI: "./scalars.ts#Uri"
12 }
13 } as const
14
15 describe("Config", () => {
16 it("the config Schema decodes the documented example", () => {
17 assert.deepStrictEqual(Schema.decodeUnknownSync(Config.Config)(example), example)
18 })
19
20 it("importExtension is .ts or .js; an empty extension is rejected", () => {
21 assert.isTrue(Exit.isSuccess(Schema.decodeUnknownExit(Config.Config)({ ...example, importExtension: ".js" })))
22 assert.isTrue(Exit.isFailure(Schema.decodeUnknownExit(Config.Config)({ ...example, importExtension: "" })))
23 })
24
25 it("rejects a scalar specifier without a #", () => {
26 const exit = Schema.decodeUnknownExit(Config.Config)({ ...example, scalars: { URI: "./scalars.ts" } })
27 assert.isTrue(Exit.isFailure(exit))
28 })
29 })