Skip to content

test: cover SQL dump import edge cases - #163

Open
kaziiza wants to merge 1 commit into
outerbase:mainfrom
kaziiza:codex/dump-import-coverage-71
Open

kaziiza wants to merge 1 commit into
outerbase:mainfrom
kaziiza:codex/dump-import-coverage-71

Conversation

@kaziiza

@kaziiza kaziiza commented May 12, 2026

Copy link
Copy Markdown

/claim #71

Summary

Adds focused Vitest coverage for SQL dump import behavior in src/import/dump.ts.

Covered behavior:

  • strips an actual SQLite format 3 header before execution
  • parses multiline SQL statements while skipping comments and blank lines
  • executes a final statement without a trailing semicolon
  • accepts comments-only dumps without executing statements
  • returns 207 with accurate details for mixed success/failure execution
  • returns 500 when multipart parsing fails
  • rejects non-File sqlFile form values
  • restores the final console.error spy to avoid mock leakage

This is test-only and intentionally avoids the active CSV, JSON, RLS, cache, operation, worker, handler, allowlist, Durable Object, and plugin coverage PR areas.

Verification

  • corepack pnpm exec vitest run src/import/dump.test.ts - 13 passed
  • corepack pnpm exec vitest run src/import/dump.test.ts --coverage.enabled true --coverage.include src/import/dump.ts --coverage.reporter text --coverage.thresholds.lines=0 --coverage.thresholds.branches=0 --coverage.thresholds.functions=0 --coverage.thresholds.statements=0 - src/import/dump.ts at 100% statements, 96.15% branches, 100% functions, 100% lines
  • corepack pnpm exec prettier --check src/import/dump.test.ts - passed
  • git diff --check -- src/import/dump.test.ts - passed with CRLF warning only
  • corepack pnpm exec vitest run - dump tests pass; existing unrelated RLS failures remain in src/rls/index.test.ts

Demo video

@kaziiza

kaziiza commented May 13, 2026

Copy link
Copy Markdown
Author

Additional verification (2026-05-13 JST):

  • corepack pnpm install passed.
  • corepack pnpm exec vitest run src/import/dump.test.ts passed: 13 tests.
  • corepack pnpm exec prettier --check src/import/dump.test.ts passed.
  • Focused Istanbul coverage for src/import/dump.ts passed with 100% statements, 96.15% branches, 100% functions, and 100% lines.
  • Full corepack pnpm exec vitest run still has unrelated existing failures in src/rls/index.test.ts; the dump import tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant