Skip to content

Add unit tests, integration tests, and CI#4

Merged
deepa0128 merged 1 commit into
feat/generic-fetchfrom
feat/test-suite
Apr 23, 2026
Merged

Add unit tests, integration tests, and CI#4
deepa0128 merged 1 commit into
feat/generic-fetchfrom
feat/test-suite

Conversation

@deepa0128

Copy link
Copy Markdown
Owner

What

Wires up a full test suite and GitHub Actions CI pipeline.

Unit tests — 103 tests, no database required

File What it covers
test/unit/identifier.test.ts Identifier safety — valid names, all rejection cases
test/unit/builder/expr.test.ts All 11 expression helpers
test/unit/builder/select.test.ts SelectBuilder — columns, where, orderBy, limit, offset, error cases
test/unit/builder/insert.test.ts InsertBuilder — single/multi-row, error cases
test/unit/builder/update.test.ts UpdateBuilder — sets, where, no-where allowed
test/unit/builder/delete.test.ts DeleteBuilder — where, no-where allowed
test/unit/dialect/compileQuery.test.ts Full SQL compiler — exact SQL strings and params for both dialects, all operators, edge cases

Integration tests — skipped locally without a database

Tests hit real Postgres and MySQL instances. Skipped automatically when POSTGRES_URL / MYSQL_URL env vars are absent, so npm test always passes locally without Docker.

Covers: INSERT, SELECT (with filters / limit / offset), UPDATE, DELETE, transaction commit, transaction rollback, nested-transaction rejection, and ConstraintError on unique violations.

CI (.github/workflows/ci.yml)

Runs on every push and PR across Node 18 / 20 / 22. Spins up Postgres 16 and MySQL 8 service containers with health checks, then runs:

  1. tsc --noEmit on source
  2. tsc --noEmit on tests (tsconfig.test.json)
  3. npm run build
  4. npm test (unit)
  5. npm run test:integration (with POSTGRES_URL / MYSQL_URL injected)

Test scripts added to package.json

npm test                  # unit tests only
npm run test:watch        # unit tests in watch mode
npm run test:integration  # integration tests (needs DB)
npm run test:all          # both
npm run typecheck         # tsc on src + test together

Stacks on #3.

@deepa0128
deepa0128 merged commit a94c49c into feat/generic-fetch Apr 23, 2026
3 checks passed
@deepa0128
deepa0128 deleted the feat/test-suite branch April 23, 2026 09: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