Skip to content

test: add coverage for checkSqlDefaultBody - #30337

Open
EmaToplek wants to merge 1 commit into
prisma:mainfrom
EmaToplek:test/contract-default-sql-body-coverage
Open

EmaToplek wants to merge 1 commit into
prisma:mainfrom
EmaToplek:test/contract-default-sql-body-coverage

Conversation

@EmaToplek

@EmaToplek EmaToplek commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds test coverage for checkSqlDefaultBody in packages/2-sql/1-core/contract/src/default-sql-body.ts.

  • default-sql-body.ts: 100% statements/branches/functions/lines (up from 83%/60%/50%/83%)

Summary by CodeRabbit

  • Tests
    • Expanded validation coverage for SQL default expressions.
    • Confirmed safe expressions such as now() are accepted.
    • Added checks that reject semicolons, SQL comments, dollar-quoting, and subqueries in default expressions.

Signed-off-by: EmaToplek <toplek.ema0213@outlook.com>
@EmaToplek
EmaToplek requested a review from a team as a code owner September 17, 2026 21:26
@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Advanced

Run ID: 0dbf6cf9-3247-4fd4-9520-d3d79f0a0267

📥 Commits

Reviewing files that changed from the base of the PR and between 1c434a7 and da300bf.

📒 Files selected for processing (1)
  • packages/2-sql/1-core/contract/test/default-sql-body.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The test suite imports checkSqlDefaultBody and verifies accepted now() input and rejection of semicolons, comments, dollar-quoting, and subqueries.

Changes

SQL default body validation

Layer / File(s) Summary
Default body validation coverage
packages/2-sql/1-core/contract/test/default-sql-body.test.ts
The tests cover safe default SQL bodies and invalid bodies containing SQL syntax that must produce the fixed error message.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: wmadden-electric

Merge Risk: ⚪ Minimal · up to da300

This change adds focused validation tests without introducing production behavior changes, so it is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely states that the pull request adds test coverage for checkSqlDefaultBody, which matches the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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