Skip to content

test: add Vitest unit tests for allowlist, CSV import, and plugins - #347

Open
khuxaiphi-stack wants to merge 6 commits into
outerbase:mainfrom
khuxaiphi-stack:test/vitest-coverage
Open

khuxaiphi-stack wants to merge 6 commits into
outerbase:mainfrom
khuxaiphi-stack:test/vitest-coverage

Conversation

@khuxaiphi-stack

Copy link
Copy Markdown

/claim #71
Fixes #71

Summary

Improves Vitest unit test coverage across core modules (src/allowlist, src/import) and plugins (plugins/cron, plugins/sql-macros, plugins/stats), and fixes AST array normalization in SqlMacrosPlugin.checkSelectStar.

Key Changes

  • src/allowlist/index.test.ts: Unit tests for table allowlist validation (SELECT, INSERT, UPDATE, DELETE) and procedure call enforcement.
  • src/import/csv.test.ts: Unit tests for CSV parsing, schema inference, table creation, and row insertion.
  • plugins/cron/index.test.ts: Unit tests for CronPlugin initialization, route registration, and scheduled task handling.
  • plugins/sql-macros/index.test.ts & plugins/sql-macros/index.ts: Unit tests for macro registration, query expansion, and disallowSelectStar enforcement (including normalizing AST arrays returned by Parser.astify in checkSelectStar).
  • plugins/stats/index.test.ts: Unit tests for QueryStatsPlugin query tracking and /stats endpoint responses.

Verification

  • npx vitest run — 18 / 18 new unit tests passing

Solana Payout Wallet: FyexYHp1TZ6uzFLUvFNfofx14LQaBrYHbQksTo18xRgD

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