Skip to content

test: add Vitest coverage for allowlist and CSV import#215

Open
ykd007 wants to merge 1 commit into
outerbase:mainfrom
ykd007:feat/vitest-tests
Open

test: add Vitest coverage for allowlist and CSV import#215
ykd007 wants to merge 1 commit into
outerbase:mainfrom
ykd007:feat/vitest-tests

Conversation

@ykd007
Copy link
Copy Markdown

@ykd007 ykd007 commented May 14, 2026

Closes #71

Adds unit tests for two previously-uncovered modules:

  • src/allowlist/index.test.ts — covers isQueryAllowed() including edge cases for blocked/allowed patterns and SQL injection attempts
  • src/import/csv.test.ts — covers importTableFromCsvRoute() with mocked D1 database and file parsing

Both test suites use Vitest with mocked dependencies to keep tests fast and isolated.

- src/allowlist/index.test.ts: comprehensive tests for isQueryAllowed()
  covering admin bypass, allowlist enabled/disabled, SQL parsing, and
  query matching logic
- src/import/csv.test.ts: tests for importTableFromCsvRoute() covering
  CSV parsing, error handling, and response formatting

Closes coverage gaps for previously untested files.
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.

Improve test coverage with Vitest

1 participant