test: add JS test framework using Node built-in test runner
Extracted pure utility functions (esc, sanitize, formatBytes, formatTime) into web/ui/util.js with CommonJS export for Node testing compatibility. Added 19 tests across 4 suites using node:test + node:assert (zero deps). - util.js: browser-compatible utility functions - util.test.js: 19 tests (5 esc, 3 sanitize, 6 formatBytes, 5 formatTime) - package.json: 'test' script → node --test util.test.js - mise.toml: js-test task - app.js: removed duplicate helper functions (now in util.js) - index.html: load util.js before app.js
This commit was merged in pull request #14.
This commit is contained in:
@@ -13,6 +13,7 @@ all = { run = "go build -buildvcs=false -o fetch . && make -C third_party/akaiut
|
||||
serve = { run = "go build -buildvcs=false -o fetch . && ./fetch serve" }
|
||||
lint = "golangci-lint run"
|
||||
js-lint = "cd web/ui && npm run lint"
|
||||
js-test = "cd web/ui && npm test"
|
||||
electron-deps = "cd electron && npm install"
|
||||
electron-dev = { run = "go build -buildvcs=false -o fetch . && cd electron && npx electron ." }
|
||||
electron-build = { run = "go build -buildvcs=false -o fetch . && make -C third_party/akaiutil && cd electron && npx electron-builder --dir" }
|
||||
|
||||
Reference in New Issue
Block a user