/*** IMPORT ------------------------------------------- ***/ import { expect, test } from "vitest"; /*** UTILITY ------------------------------------------ ***/ import { format } from "../source/library/graphql/format.ts"; /*** TESTS -------------------------------------------- ***/ test("format pretty-prints a valid query", () => { const input = "query Foo{viewer{id name}}"; const expected = "query Foo {\n viewer {\n id\n name\n }\n}"; expect(format(input)).toEqual(expected); }); test("format returns the input unchanged on parse failure", () => { const input = "query { ..."; expect(format(input)).toEqual(input); }); test("format returns empty string for empty input", () => { expect(format("")).toEqual(""); });