--- name: test description: Run tests or create test coverage for Archipelago disable-model-invocation: true allowed-tools: Read, Edit, Write, Glob, Grep, Bash argument-hint: "[area: backend|frontend|all] or [specific-file]" --- Run or create tests for $ARGUMENTS. ## Backend Testing (Rust) ### Run existing tests ```bash # On dev server (never build Rust on macOS) ssh -i ~/.ssh/archipelago-deploy archipelago@192.168.1.228 \ 'source ~/.cargo/env && cd ~/archy/core && cargo test --all-features 2>&1' ``` ### Creating new tests - Place unit tests in the same file with `#[cfg(test)]` module - Place integration tests in `core/{crate}/tests/` - Use `#[tokio::test]` for async tests - Mock external dependencies (filesystem, network, Podman) - Test error cases, not just happy paths - Aim for >80% coverage on core logic ### Priority areas needing tests 1. RPC endpoint handlers (core/archipelago/src/api/) 2. Manifest parsing (core/container/src/manifest.rs) 3. Dependency resolver (core/container/src/dependency_resolver.rs) 4. Auth flows (core/archipelago/src/auth.rs) 5. Secrets manager (core/security/src/secrets_manager.rs) 6. Port allocation (core/container/src/port_manager.rs) ## Frontend Testing (Vue/TypeScript) ### Setup (if not already configured) Ensure vitest is configured in `neode-ui/`: ```bash cd neode-ui && npm run test 2>&1 || echo "No test script configured" ``` ### Creating new tests - Use Vitest + @vue/test-utils - Place tests in `neode-ui/src/__tests__/` or co-located `*.test.ts` - Test stores (Pinia) with `createTestingPinia()` - Test API clients with mocked fetch - Test component rendering and interactions - Test routing guards ### Priority areas needing tests 1. Pinia stores (app.ts, container.ts, appLauncher.ts) 2. RPC client (api/rpc-client.ts) — error handling, retry logic 3. WebSocket client (api/websocket.ts) — reconnection 4. Router guards — auth flow, session timeout 5. Key components — ContainerStatus, SpotlightSearch Report test results and any new tests created.