Skip to content

Commit 1d74b37

Browse files
committed
chore(test): Add $test alias for easier code organization
1 parent 30cbc59 commit 1d74b37

16 files changed

+23
-20
lines changed

AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ Use data-driven testing across **all 5 routing universes**:
262262

263263
```typescript
264264
// Import the complete universe definitions
265-
import { ROUTING_UNIVERSES } from "../testing/test-utils.js";
265+
import { ROUTING_UNIVERSES } from "$test/test-utils.js";
266266

267267
ROUTING_UNIVERSES.forEach((ru) => {
268268
describe(`Component - ${ru.text}`, () => {
@@ -741,7 +741,7 @@ test("Should react to state changes.", () => {
741741
For testing components that rely on `window.location` and `window.history` (like `RouterEngine`), use the comprehensive browser mocking utilities:
742742

743743
```typescript
744-
import { setupBrowserMocks } from "../testing/test-utils.js";
744+
import { setupBrowserMocks } from "$test/test-utils.js";
745745

746746
describe("Component requiring browser APIs", () => {
747747
beforeEach(() => {
@@ -807,7 +807,7 @@ Refer to `src/testing/test-utils.ts` for complete function signatures and type d
807807
**Complete test coverage across all 5 routing universes** using the standardized pattern:
808808

809809
```typescript
810-
import { ROUTING_UNIVERSES } from "../testing/test-utils.js";
810+
import { ROUTING_UNIVERSES } from "$test/test-utils.js";
811811

812812
// ✅ Recommended: Test ALL universes with single loop
813813
ROUTING_UNIVERSES.forEach((universe) => {
@@ -856,7 +856,7 @@ Use dictionary-based constants for better maintainability:
856856

857857
```typescript
858858
// Import self-documenting hash values
859-
import { ALL_HASHES } from "../testing/test-utils.js";
859+
import { ALL_HASHES } from "$test/test-utils.js";
860860

861861
// Usage in tests
862862
test("Should validate hash compatibility.", () => {

src/lib/Fallback/Fallback.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { init } from "$lib/init.js";
22
import { describe, test, expect, beforeAll, afterAll, beforeEach } from "vitest";
33
import { render } from "@testing-library/svelte";
44
import Fallback from "./Fallback.svelte";
5-
import { addMatchingRoute, addRoutes, createRouterTestSetup, createTestSnippet, ROUTING_UNIVERSES, ALL_HASHES } from "../../testing/test-utils.js";
5+
import { addMatchingRoute, addRoutes, createRouterTestSetup, createTestSnippet, ROUTING_UNIVERSES, ALL_HASHES } from "$test/test-utils.js";
66
import { flushSync } from "svelte";
77
import { resetRoutingOptions, setRoutingOptions } from "$lib/kernel/options.js";
88
import type { ExtendedRoutingOptions } from "$lib/types.js";

src/lib/Link/Link.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { location } from "$lib/kernel/Location.js";
33
import { describe, test, expect, beforeAll, afterAll, beforeEach, vi, afterEach } from "vitest";
44
import { render, fireEvent } from "@testing-library/svelte";
55
import Link from "./Link.svelte";
6-
import { createRouterTestSetup, createTestSnippet, ROUTING_UNIVERSES, ALL_HASHES, createWindowMock, setupBrowserMocks, type RoutingUniverse, addMatchingRoute } from "../../testing/test-utils.js";
6+
import { createRouterTestSetup, createTestSnippet, ROUTING_UNIVERSES, ALL_HASHES, createWindowMock, setupBrowserMocks, type RoutingUniverse, addMatchingRoute } from "$test/test-utils.js";
77
import { flushSync } from "svelte";
88
import { resetRoutingOptions, setRoutingOptions } from "$lib/kernel/options.js";
99
import type { ExtendedRoutingOptions } from "$lib/types.js";

src/lib/LinkContext/LinkContext.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, test, expect, vi, afterEach } from "vitest";
22
import { render } from "@testing-library/svelte";
33
import { linkCtxKey, type ILinkContext } from "./LinkContext.svelte";
4-
import TestLinkContextWithContextSpy from "../../testing/TestLinkContextWithContextSpy.svelte";
4+
import TestLinkContextWithContextSpy from "$test/TestLinkContextWithContextSpy.svelte";
55
import { flushSync } from "svelte";
66
import type { ActiveStateAriaAttributes } from "$lib/types.js";
77

src/lib/Route/Route.svelte.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { describe, test, expect, beforeEach, vi, beforeAll, afterAll, afterEach } from "vitest";
22
import { render } from "@testing-library/svelte";
33
import Route from "./Route.svelte";
4-
import { createTestSnippet, createRouterTestSetup, ROUTING_UNIVERSES, ALL_HASHES } from "../../testing/test-utils.js";
4+
import { createTestSnippet, createRouterTestSetup, ROUTING_UNIVERSES, ALL_HASHES } from "$test/test-utils.js";
55
import { init } from "$lib/init.js";
66
import { location } from "$lib/kernel/Location.js";
7-
import TestRouteWithRouter from "../../testing/TestRouteWithRouter.svelte";
7+
import TestRouteWithRouter from "$test/TestRouteWithRouter.svelte";
88
import { resetRoutingOptions, setRoutingOptions } from "$lib/kernel/options.js";
99
import type { ExtendedRoutingOptions, InitOptions } from "$lib/types.js";
1010

src/lib/Router/Router.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, test, expect, beforeEach, vi, beforeAll, afterAll } from "vit
22
import { render } from "@testing-library/svelte";
33
import Router, { getRouterContextKey } from "./Router.svelte";
44
import { RouterEngine } from "$lib/kernel/RouterEngine.svelte.js";
5-
import { createTestSnippet, createRouterTestSetup, ROUTING_UNIVERSES } from "../../testing/test-utils.js";
5+
import { createTestSnippet, createRouterTestSetup, ROUTING_UNIVERSES } from "$test/test-utils.js";
66
import { flushSync } from "svelte";
77
import { init } from "$lib/init.js";
88

src/lib/behaviors/active.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { activeBehavior } from "./active.svelte.js";
33
import { RouterEngine } from "$lib/kernel/RouterEngine.svelte.js";
44
import type { ActiveState, RouteStatus } from "$lib/types.js";
55
import { render } from "@testing-library/svelte";
6-
import TestActiveBehavior from "../../testing/TestActiveBehavior.svelte";
6+
import TestActiveBehavior from "$test/TestActiveBehavior.svelte";
77
import { flushSync } from "svelte";
88
import type { ClassValue } from "svelte/elements";
99
import { clsx } from "clsx";

src/lib/kernel/InterceptedHistoryApi.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, test, expect, beforeEach, afterEach, vi } from "vitest";
22
import { InterceptedHistoryApi } from "./InterceptedHistoryApi.svelte.js";
33
import type { State, BeforeNavigateEvent } from "../types.js";
4-
import { setupBrowserMocks } from "../../testing/test-utils.js";
4+
import { setupBrowserMocks } from "$test/test-utils.js";
55

66
describe("InterceptedHistoryApi", () => {
77
const initialUrl = "http://example.com/";

src/lib/kernel/LocationFull.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
22
import { LocationFull } from "./LocationFull.js";
33
import type { State, Location, FullModeHistoryApi } from "../types.js";
4-
import { setupBrowserMocks, ALL_HASHES } from "../../testing/test-utils.js";
4+
import { setupBrowserMocks, ALL_HASHES } from "$test/test-utils.js";
55
import { SvelteURL } from "svelte/reactivity";
66

77
describe("LocationFull", () => {

src/lib/kernel/LocationLite.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, test, expect, beforeEach, afterEach, vi } from "vitest";
22
import { LocationLite } from "./LocationLite.svelte.js";
33
import type { ExtendedRoutingOptions, Hash, HistoryApi, PreserveQuery } from "../types.js";
4-
import { setupBrowserMocks, ALL_HASHES } from "../../testing/test-utils.js";
4+
import { setupBrowserMocks, ALL_HASHES } from "$test/test-utils.js";
55
import { SvelteURL } from "svelte/reactivity";
66
import { setLocation } from "./Location.js";
77
import { resetRoutingOptions, setRoutingOptions } from "./options.js";

0 commit comments

Comments
 (0)