Skip to content

The open alternative to Salesforce, designed for AI.

2.7 KB
Raw Blame

Ported genql 3.0.5 test suite

Port of the test suite of remorses/genql at @genql/[email protected] (commit 4a547db46a9a614cc2b5958e28674af351898464), the version the codegen in ../../genql was vendored from. It protects the vendored engine's behavior; the engine's output bytes are pinned by ../genql-engine-output.test.ts and by the checked-in fixture/generated/ client (generated-fixture-drift.test.ts).

Here Upstream
fixture/schema.graphql integration-tests/schema.graphql (byte-verbatim)
fixture/generated/ output of the vendored engine for that schema, checked in so type-level assertions compile; pinned by generated-fixture-drift.test.ts
generate-queries.test.ts integration-tests/tests/simple.ts
execute-queries.test.ts integration-tests/tests/execution.ts
type-selection.test.ts cli/src/typeSelection.test.ts
type-map.test.ts cli/src/render/typeMap/index.test.ts
render-typing.test.ts cli/src/render/common/__tests__/renderTyping.test.ts
comment.test.ts cli/src/render/common/__tests__/comment.test.ts
render-context.test.ts cli/src/render/common/__tests__/RenderContext.test.ts
render-schema.test.ts cli/src/render/schema/renderSchema.test.ts
render-test-helpers.ts cli/src/testHelpers/render.ts

Not ported: parse.test.ts and printer.test.ts (they cover CLI/printer code Twenty did not vendor) and the subscription suite (already skipped upstream).

Adaptations

Selections, resolvers, assertions and test names are upstream's. What changed:

  • mocha/sucrase/snap-shot-it → vitest. Snapshots are vitest snapshots.
  • apollo-server (v3, deprecated) → graphql-js execution. execution.ts booted a real HTTP server per test; execute-queries.test.ts runs the same resolvers through graphql() behind an injected fetch/fetcher, which exercises the identical client code path with no network and no new dependency.
  • tsd expectType → vitest expectTypeOf, strengthened to exact. Upstream's CI did typecheck its integration tests (its gen step ran tsc --noEmit over tests plus a freshly generated client), but it never ran the tsd CLI — and under plain tsc, tsd's expectType<T>(value) degrades to an assignability check. Several assertions were therefore looser than the real types. The exact assertions here pin what the 3.0.5 engine actually generates (fields absent from a response are undefined, never null; __typename is a literal type) and are enforced by the package typecheck.
  • type-map.test.ts assertions enabled. Upstream ran them in output-logging mode with stale expected values; the values here match the engine's actual output.