- Install vitest + jsdom - Add test/test:watch scripts to package.json - Add test:web and test:all tasks to mise.toml - Add dayCapabilities() to utils.ts — single source of truth for what actions are permitted per day (future/today/past, open/closed) - Add DayCapabilities interface to utils.ts - 11 unit tests: dayCapabilities (5 cases), weekDayKeys (3 cases), isWorkday (3 cases)
67 lines
1.3 KiB
TOML
67 lines
1.3 KiB
TOML
[tools]
|
|
go = "1.26.2"
|
|
node = "24.14.0"
|
|
npm = "latest"
|
|
|
|
[env]
|
|
AUTH_TOKEN = "devtoken"
|
|
PORT = "8080"
|
|
DB_PATH = "wotra.db"
|
|
TZ = "UTC"
|
|
|
|
[tasks.build]
|
|
description = "Build production single binary (web + Go)"
|
|
depends = ["build:web", "build:go"]
|
|
|
|
[tasks."build:web"]
|
|
description = "Build Svelte frontend"
|
|
dir = "web"
|
|
run = "npm run build"
|
|
|
|
[tasks."build:go"]
|
|
description = "Build Go binary with embedded web assets"
|
|
run = "go build -tags production -o wotra ./cmd/wotra"
|
|
|
|
[tasks.dev]
|
|
description = "Start Go API and Vite dev server concurrently"
|
|
run = """
|
|
echo "Go API: http://localhost:${PORT}"
|
|
echo "Vite UI: http://localhost:5173"
|
|
mise run dev:api & mise run dev:ui
|
|
wait
|
|
"""
|
|
|
|
[tasks."dev:api"]
|
|
description = "Start Go API server"
|
|
run = "go run ./cmd/wotra"
|
|
|
|
[tasks."dev:ui"]
|
|
description = "Start Vite dev server"
|
|
dir = "web"
|
|
run = "npm run dev"
|
|
|
|
[tasks.test]
|
|
description = "Run all Go tests"
|
|
run = "go test ./..."
|
|
|
|
[tasks."test:web"]
|
|
description = "Run frontend Vitest unit tests"
|
|
dir = "web"
|
|
run = "npm test"
|
|
|
|
[tasks."test:all"]
|
|
description = "Run Go tests and frontend Vitest tests"
|
|
depends = ["test", "test:web"]
|
|
|
|
[tasks.install]
|
|
description = "Install frontend npm dependencies"
|
|
dir = "web"
|
|
run = "npm install"
|
|
|
|
[tasks.clean]
|
|
description = "Remove build artifacts"
|
|
run = """
|
|
rm -f wotra
|
|
rm -rf web/build web/.svelte-kit
|
|
"""
|