Skip to content

Commit c27fbc0

Browse files
committed
test: add comprehensive testing infrastructure and 166 tests
Add complete testing framework for Web application with 166 passing tests covering all critical paths, security controls, and business logic. Test Infrastructure: - Vitest + @testing-library/svelte + happy-dom setup - Mock D1 database with datetime comparison support - Test fixtures and helpers for common test patterns - Enhanced D1 mock supporting UPDATE literals and INSERT datetime functions New Test Files (166 tests total): - src/lib/test/setup.test.ts (4 tests) - test infrastructure verification - src/lib/test/migration-0006.test.ts (9 tests) - migration logic - src/routes/[username]/[slug]/install/server.test.ts (10 tests) - install script visibility - src/routes/[username]/[slug]/config/server.test.ts (7 tests) - config JSON visibility - src/routes/api/configs/server.test.ts (21 tests) - config CRUD (list) - src/routes/api/configs/[slug]/server.test.ts (25 tests) - config CRUD (single) - src/routes/api/auth/cli/start/server.test.ts (9 tests) - CLI auth start - src/routes/api/auth/cli/poll/server.test.ts (9 tests) - CLI auth polling - src/routes/api/auth/cli/approve/server.test.ts (10 tests) - CLI auth approval - src/lib/server/install-script.test.ts (33 tests) - install script generation - src/lib/server/validation.test.ts (29 tests) - input validation functions Key Coverage: - OAuth flow (start/poll/approve) with Bearer token auth - 3-tier visibility model (public/unlisted/private) - Private config access control and error handling - Install script generation (public and private variants) - Custom script and dotfiles integration - Input validation (XSS, open redirect, shell injection prevention) - Migration logic (is_public → visibility field) - Rate limiting and error scenarios CI/CD: - Add test step to deploy workflow (.github/workflows/deploy.yml) - Tests run before every deployment All tests passing. Build verified.
1 parent c1e8187 commit c27fbc0

File tree

19 files changed

+5031
-1
lines changed

19 files changed

+5031
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
- name: Install dependencies
2020
run: npm install --legacy-peer-deps
2121

22+
- name: Run tests
23+
run: npm run test:run
24+
2225
- name: Build
2326
run: npm run build
2427

0 commit comments

Comments
 (0)