diff --git a/packages/core-v2/README.md b/packages/core-v2/README.md index f546a58..b66a50b 100644 --- a/packages/core-v2/README.md +++ b/packages/core-v2/README.md @@ -308,6 +308,10 @@ Each module depends only on the ones listed above it. | `gesture/recognizer.ts` | Pointer-down admission, `DirectionalTracker`, `GestureRecognizer`, and `useOriginGesture` | | `components/` | `OriginScene`, `OriginGesture`, `OriginGestureSurface`, and the internal node host | +Tests live in `tests/`, outside `src/`. `tests/property.test.ts` checks the +scene's structural invariants after every step of random operation sequences +and pointer streams; set `PROPERTY_SEEDS` to run more than the default 60. + Pure helpers used by a class (for example `matchesStart`, `stepSpring`, or `composeNodeStyle`) are module-level `export const`s that the class calls, so they can be tested directly without widening the class's interface. diff --git a/packages/core-v2/src/gesture.test.ts b/packages/core-v2/tests/gesture.test.ts similarity index 99% rename from packages/core-v2/src/gesture.test.ts rename to packages/core-v2/tests/gesture.test.ts index 1e45289..95d909f 100644 --- a/packages/core-v2/src/gesture.test.ts +++ b/packages/core-v2/tests/gesture.test.ts @@ -13,7 +13,7 @@ import { useOriginGesture, type OriginGestureBinding, type OriginGestureCompletionContext, -} from "."; +} from "../src"; const mountedApps: Array> = []; diff --git a/packages/core-v2/src/haptics.test.ts b/packages/core-v2/tests/haptics.test.ts similarity index 99% rename from packages/core-v2/src/haptics.test.ts rename to packages/core-v2/tests/haptics.test.ts index d939045..38d53e6 100644 --- a/packages/core-v2/src/haptics.test.ts +++ b/packages/core-v2/tests/haptics.test.ts @@ -19,7 +19,7 @@ import { originView, useOriginGesture, type OriginGestureDefinition, -} from "."; +} from "../src"; const apps: Array> = []; afterEach(() => { diff --git a/packages/core-v2/src/property.test.ts b/packages/core-v2/tests/property.test.ts similarity index 99% rename from packages/core-v2/src/property.test.ts rename to packages/core-v2/tests/property.test.ts index e4dbb19..420ebd4 100644 --- a/packages/core-v2/src/property.test.ts +++ b/packages/core-v2/tests/property.test.ts @@ -23,9 +23,9 @@ import { under, type OriginAction, type OriginOperationHandle, -} from "."; -import type { SceneGraph } from "./scene/graph"; -import type { OriginScene as Scene } from "./scene/types"; +} from "../src"; +import type { SceneGraph } from "../src/scene/graph"; +import type { OriginScene as Scene } from "../src/scene/types"; const SEEDS = Number(process.env.PROPERTY_SEEDS ?? 60); diff --git a/packages/core-v2/src/recognizer.test.ts b/packages/core-v2/tests/recognizer.test.ts similarity index 99% rename from packages/core-v2/src/recognizer.test.ts rename to packages/core-v2/tests/recognizer.test.ts index c7caaaa..bfcb677 100644 --- a/packages/core-v2/src/recognizer.test.ts +++ b/packages/core-v2/tests/recognizer.test.ts @@ -19,8 +19,8 @@ import { OriginSceneError, originView, type OriginGestureDefinition, -} from "."; -import { shouldCommit } from "./scene/graph"; +} from "../src"; +import { shouldCommit } from "../src/scene/graph"; const apps: Array> = []; afterEach(() => { diff --git a/packages/core-v2/src/scene.test.ts b/packages/core-v2/tests/scene.test.ts similarity index 99% rename from packages/core-v2/src/scene.test.ts rename to packages/core-v2/tests/scene.test.ts index 97359a3..e36a645 100644 --- a/packages/core-v2/src/scene.test.ts +++ b/packages/core-v2/tests/scene.test.ts @@ -18,7 +18,7 @@ import { originView, replace, under, -} from "."; +} from "../src"; const mountedApps: Array> = []; diff --git a/packages/core-v2/tsconfig.json b/packages/core-v2/tsconfig.json index 6dd71ae..e5b3341 100644 --- a/packages/core-v2/tsconfig.json +++ b/packages/core-v2/tsconfig.json @@ -9,6 +9,5 @@ "outDir": "dist", "tsBuildInfoFile": "../../node_modules/.tmp/core-v2.tsbuildinfo" }, - "include": ["src/**/*.ts", "src/**/*.vue"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts", "src/**/*.vue"] } diff --git a/packages/core-v2/verify/README.md b/packages/core-v2/verify/README.md index 00f08f5..9e4771c 100644 --- a/packages/core-v2/verify/README.md +++ b/packages/core-v2/verify/README.md @@ -15,6 +15,6 @@ ONLY=rewrite npx vitest bench --run --config packages/core-v2/verify/vitest.conf Run each implementation in its own process with `ONLY=`; running both in one process biases whichever runs second. -Behavioural verification lives with the unit tests: `src/property.test.ts` +Behavioural verification lives with the unit tests: `tests/property.test.ts` drives random operation sequences and pointer streams and checks the scene's structural invariants after every step. Set `PROPERTY_SEEDS` to run more. diff --git a/tsconfig.app.json b/tsconfig.app.json index a7593b8..30ae69a 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -24,6 +24,7 @@ "apps/demo/src/**/*.ts", "apps/demo/src/**/*.vue", "packages/*/src/**/*.ts", - "packages/*/src/**/*.vue" + "packages/*/src/**/*.vue", + "packages/*/tests/**/*.ts" ] }