diff options
| author | netop://ウィビ <paul@webb.page> | 2026-04-24 16:37:49 -0700 |
|---|---|---|
| committer | netop://ウィビ <paul@webb.page> | 2026-04-24 16:37:49 -0700 |
| commit | c013ed57bf3d7dd83bd59a9b984d87aebde6003c (patch) | |
| tree | 31d25456496f013f13f3cae1ded376d5323b3200 /tests/history.test.ts | |
| parent | 510fd8cbe53abb39cba2c7cbaaefcf2783dc0066 (diff) | |
| download | graphiql-c013ed57bf3d7dd83bd59a9b984d87aebde6003c.tar.gz graphiql-c013ed57bf3d7dd83bd59a9b984d87aebde6003c.zip | |
Migrate from Deno/JSR to npm publishing
- @sveltejs/package builds dist/ for @eeeooolll/graphiql with three entry
points (./, ./component, ./splitter)
- Vitest + svelte-check replace Deno test/check; runes shim no longer
needed since the Svelte plugin compiles .svelte.ts at runtime
- Drop $app/environment dep in Editor.svelte to support non-SvelteKit
consumers
- Refactor TabBar tab element from nested <button> to role=tab <div> per
PLAN.md gotcha; svelte-check flagged the invalid HTML
- README now documents npm install, integration patterns for Yoga,
Apollo, graphql-modules, Hono/Bun/Deno, plus APQ + keyboard table
Diffstat (limited to 'tests/history.test.ts')
| -rw-r--r-- | tests/history.test.ts | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tests/history.test.ts b/tests/history.test.ts index ecd7785..a08c014 100644 --- a/tests/history.test.ts +++ b/tests/history.test.ts @@ -1,9 +1,10 @@ + /*** IMPORT ------------------------------------------- ***/ -import { assertEquals } from "jsr:@std/assert@^1.0.0"; +import { expect, test } from "vitest"; /*** UTILITY ------------------------------------------ ***/ @@ -21,12 +22,12 @@ function entry(id: string, timestamp: number, favorite = false): Entry { /*** TESTS -------------------------------------------- ***/ -Deno.test("evict keeps everything when under cap", () => { +test("evict keeps everything when under cap", () => { const entries = [entry("a", 3), entry("b", 2), entry("c", 1)]; - assertEquals(evict(entries, 5), entries); + expect(evict(entries, 5)).toEqual(entries); }); -Deno.test("evict drops the oldest non-favorites above cap", () => { +test("evict drops the oldest non-favorites above cap", () => { const entries = [ entry("a", 5), entry("b", 4), @@ -35,10 +36,10 @@ Deno.test("evict drops the oldest non-favorites above cap", () => { entry("e", 1) ]; const kept = evict(entries, 3); - assertEquals(kept.map((e) => e.id), ["a", "b", "c"]); + expect(kept.map((e) => e.id)).toEqual(["a", "b", "c"]); }); -Deno.test("evict never drops favorites", () => { +test("evict never drops favorites", () => { const entries = [ entry("a", 10), entry("b", 9), @@ -48,11 +49,11 @@ Deno.test("evict never drops favorites", () => { ]; const kept = evict(entries, 3); - assertEquals(kept.some((e) => e.id === "fav-old"), true); - assertEquals(kept.length, 3); + expect(kept.some((e) => e.id === "fav-old")).toEqual(true); + expect(kept.length).toEqual(3); }); -Deno.test("evict can exceed cap when favorites alone do so", () => { +test("evict can exceed cap when favorites alone do so", () => { const entries = [ entry("fav-1", 5, true), entry("fav-2", 4, true), @@ -61,11 +62,11 @@ Deno.test("evict can exceed cap when favorites alone do so", () => { ]; const kept = evict(entries, 2); - assertEquals(kept.length, 3); - assertEquals(kept.every((e) => e.favorite), true); + expect(kept.length).toEqual(3); + expect(kept.every((e) => e.favorite)).toEqual(true); }); -Deno.test("evict sorts by timestamp descending", () => { +test("evict sorts by timestamp descending", () => { const entries = [ entry("c", 1), entry("a", 3), @@ -73,5 +74,5 @@ Deno.test("evict sorts by timestamp descending", () => { entry("d", 0) ]; const kept = evict(entries, 3); - assertEquals(kept.map((e) => e.id), ["a", "b", "c"]); + expect(kept.map((e) => e.id)).toEqual(["a", "b", "c"]); }); |