/** * E2E integration tests: codeprism init → push flow * * Coverage: * 1. runInit() creates .codeprism/config.json with the correct structure, * writes .gitignore, rules.json, and stores selected repos * 1b. runInit() single-repo path (no checkbox prompt fired) * 2. loadWorkspaceConfig() priority: .codeprism/config.json > codeprism.config.json > auto-discover * 3. runPush() auto-fills engineUrl/apiKey from .codeprism/config.json * 4. Parent-config detection in runInit(): child-repo init defers to parent workspace * 5. Incremental re-index helpers: loadCachedGraphEdges / loadCachedFileIndex / checkCacheStaleness * 6. discoverRepos() correctly identifies git-repo subdirectories * * Isolation strategy: * - @inquirer/prompts (checkbox, input, password, select, confirm) → vi.mock (hoisted) * - fetch → vi.stubGlobal on the global fetchMock, reset per-test * - better-sqlite3 → real in-memory DB for Test 5 (no disk I/O) * - Temp directories on disk created via mkdtempSync, deleted in afterEach * - process.cwd() → vi.spyOn().mockReturnValue() where push's loadInitConfig needs it * - process.exit → vi.spyOn to prevent suite exit in guard-clause tests * * Design decisions: * - runInit() calls detectEditors(cwd) which reads real home-dir files at test time. * Rather than suppress this, we pre-load BOTH paths (checkbox for detected editors, * select for no editors) via mockCheckbox/mockSelect so the test is robust regardless * of which editors happen to exist on the CI machine. * - Tests use `mockResolvedValueOnce` in order so prompt calls are consumed in the * exact sequence they appear inside runInit's control flow. * - The "validation failure → confirm proceed" path is exercised because fetch is mocked * to reject, which mirrors the real production guard for bad API keys. */ export {}; //# sourceMappingURL=init-push-flow.test.d.ts.map