Skip to content

test: add Vitest unit test suites for allowlist, CSV import, and SQL macros (#71) - #332

Closed
jeffrey-graham wants to merge 3 commits into
outerbase:mainfrom
jeffrey-graham:test/vitest-coverage-71
Closed

jeffrey-graham wants to merge 3 commits into
outerbase:mainfrom
jeffrey-graham:test/vitest-coverage-71

Conversation

@jeffrey-graham

Copy link
Copy Markdown

Summary

Adds comprehensive Vitest unit test suites to significantly increase test coverage across previously untested modules:

  • src/allowlist/index.test.ts: Tests initializeAllowlist, checkOriginAllowed, wildcard/subdomain matching (*.domain.com, *), empty origin handling, getAllowedOrigins, addAllowedOrigin (with deduplication & normalization), and removeAllowedOrigin.
  • src/import/csv.test.ts: Tests handleCsvUpload validation errors (missing query params, invalid importType, missing primaryKey for update/upsert, empty CSV body) as well as insert, update, upsert batch generation, chunking over 50 rows, type inference (null, boolean, numeric, escaped single quotes), and partial statement failure reporting.
  • plugins/sql-macros/index.test.ts: Tests SqlMacrosPlugin registration, NOW()/TODAY()/UUID() macro expansion, custom macros, parameterized macros ($ADD_DAYS(date, days), $FULL_NAME(first, last)), and POST /macros/preview endpoint handling.

Fixes #71

/claim #71

@jeffrey-graham

Copy link
Copy Markdown
Author

Closing this PR since the #71 bounty was already completed and rewarded earlier in #74, and several overlapping test-coverage PRs are already open.

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