test: add Vitest and Phase 1 pure-helper suite

Introduce automated testing to a project that had no test runner, no
test script and no CI. Vitest fits the existing Vite setup with near-zero
config; a standalone vitest.config.ts wires the @/ alias via
vite-tsconfig-paths and runs in the node environment, avoiding the app's
Tailwind/React/WASM plugins that pure-logic tests do not need.

Cover the cheapest, highest-value surface first: pure helpers with no DOM,
WASM or database. getNextSequence and cloneField (field.ts), the
charset/collation and SQLite integer-column reordering plus enum naming
(render-uttils.ts), and orderTables including the CircularDependencyError
cycle path that backs the Foreign Key Cycle Detection feature.

The build's tsc step is unaffected (plain tsc no-ops on the root config)
and the new files typecheck clean under strict and lint clean.
This commit is contained in:
Alberto Arena
2026-08-05 06:24:18 +02:00
parent fab51f2d13
commit d0cd2d8fa4
7 changed files with 608 additions and 4 deletions
+5 -2
View File
@@ -7,7 +7,9 @@
"dev": "vite",
"build": "tsc && cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build",
"lint": "eslint -c .eslintrc.json ./src/**/**/*.{ts,tsx} --fix",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"@codemirror/lang-sql": "^6.9.0",
@@ -105,6 +107,7 @@
"typescript": "5.6.3",
"vite": "^5.2.0",
"vite-plugin-top-level-await": "^1.5.0",
"vite-tsconfig-paths": "^4.3.2"
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^2.1.9"
}
}