From 510fd8cbe53abb39cba2c7cbaaefcf2783dc0066 Mon Sep 17 00:00:00 2001 From: "netop://ウィビ" Date: Fri, 24 Apr 2026 16:37:33 -0700 Subject: Implement v0.6-1.0: shortcuts, format, export/import, splitter, timing, APQ - v0.6: matchShortcut + format(); Cmd+Shift+Enter/W/F + Cmd+Alt+arrows - v0.7: SessionStore.exportAll/importTabs with version-1 validator - v0.8: Splitter component + four resize handles persisted under layout.* - v0.10: createApqFetcher (HTTP-only) wrapping shared http-body helpers - Drop .svelte re-exports from index.ts for multi-entry JSR/npm publishing --- tests/format.test.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/format.test.ts (limited to 'tests/format.test.ts') diff --git a/tests/format.test.ts b/tests/format.test.ts new file mode 100644 index 0000000..ae5d40c --- /dev/null +++ b/tests/format.test.ts @@ -0,0 +1,28 @@ + + + + +/*** 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(""); +}); -- cgit v1.2.3