Skip to content

refactor: split monolithic integration test into 7 focused files#85

Merged
shinpr merged 2 commits intomainfrom
refactor/split-integration-tests
Mar 19, 2026
Merged

refactor: split monolithic integration test into 7 focused files#85
shinpr merged 2 commits intomainfrom
refactor/split-integration-tests

Conversation

@shinpr
Copy link
Owner

@shinpr shinpr commented Mar 19, 2026

Summary

  • Split rag-server.integration.test.ts (1285 lines, 14 describe blocks) into 7 domain-focused test files
  • Each file is fully self-contained with its own beforeAll/afterAll setup and teardown
  • No test logic changes — all 38 integration tests preserved as-is

New file structure

File Tests Scope
rag-server.protocol.integration.test.ts 5 AC-001 MCP protocol + AC-005 basic errors
rag-server.embedding.integration.test.ts 5 AC-003 vector embedding generation
rag-server.search.integration.test.ts 5 AC-004 vector search
rag-server.files.integration.test.ts 9 AC-006 format support + AC-007 file management
rag-server.ingest.integration.test.ts 4 AC-008 re-ingestion + AC-009 error handling
rag-server.delete.integration.test.ts 4 AC-010 file deletion
rag-server.metadata.integration.test.ts 6 File title extraction + meta JSON sidecar

Why this split is safe

  • No vi.mock usage in any file (compatible with isolate: false)
  • Each describe block already had independent RAGServer instances — no cross-section state dependencies
  • Test count verified: 38 before, 38 after

Test plan

  • pnpm run check:all passes (509 tests, lint, format, build, unused exports, circular deps)
  • Test count preserved (38 integration tests across 7 files)
  • CI passes

🤖 Generated with Claude Code

The 1285-line rag-server.integration.test.ts was hard to navigate and
maintain. Split it by domain into smaller, self-contained files while
preserving all 38 tests and their independent setup/teardown.

- protocol: AC-001 MCP protocol + AC-005 basic error handling (5 tests)
- embedding: AC-003 vector embedding generation (5 tests)
- search: AC-004 vector search (5 tests)
- files: AC-006 format support + AC-007 file management (9 tests)
- ingest: AC-008 re-ingestion + AC-009 error handling (4 tests)
- delete: AC-010 file deletion (4 tests)
- metadata: file title extraction + meta JSON sidecar (6 tests)

No test logic changes. All 509 tests pass, check:all green.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shinpr shinpr self-assigned this Mar 19, 2026
The network monitor captured fetch calls from other test files running
in the same process (isolate: false). Fix by snapshotting request count
before test operations and filtering model download URLs per the AC.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shinpr shinpr merged commit 9e09633 into main Mar 19, 2026
1 check passed
@shinpr shinpr deleted the refactor/split-integration-tests branch March 19, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant