* docs(core): comprehensive documentation overhaul * fix: resolve worktree paths dynamically via git CLI * refactor(ui): temporarily disable demo ad strip * fix(ui): redirect header logo and cleanup marketplace routes [Patch] - make header logo a clickable link to landing page [Patch] - cleanup marketplace routes and remove builtinPlugins [Patch] --------- Co-authored-by: Antigravity AI <[email protected]>
1.8 KiB
1.8 KiB
Testing
Overview
WorldWideView utilizes Vitest alongside a jsdom environment and the React Testing Library to ensure high reliability across core application logic, server APIs, and plugin loaders. Test coverage is strategically focused on shared libraries, core state logic, and the plugin ecosystem mechanisms.
Test Types
Unit Tests
Focused on validating standalone functions and state slice reducers without mounting React components.
- Example: Validating the runtime edition feature flags.
- File:
src/core/edition.test.ts
- File:
- Example: Validating marketplace token exchanges and rate limiting logic.
- Files:
src/lib/marketplaceToken.test.ts,src/lib/rateLimit.test.ts
- Files:
Integration Tests
Focused on ensuring module interaction, such as the event bus properly interacting with state, or plugin loaders successfully resolving manifests.
- Example: Testing local database repositories.
- File:
src/lib/repository.test.ts
- File:
- Example: Validating cross-origin resource sharing (CORS) handlers for data engine streaming.
- File:
src/lib/cors.test.ts
- File:
- Example: Verifying demo-admin bypass secrets.
- File:
src/lib/demoAdmin.test.ts
- File:
Running Tests
Execute the following commands from the root worldwideview directory:
-
Run all tests once:
pnpm test(Alias for
vitest run) -
Run tests in watch mode (for active development):
npx vitest
Reference
- Coverage Scope: The Vitest configuration primarily targets tests located inside
src/lib/**,src/core/**, andsrc/plugins/**. - Environment: The test environment is configured as
jsdomviavite.config.tsorvitest.config.ts, ensuring that DOM-specific API calls function outside of a real browser.