[PR #6166] [MERGED] chore: more join tests for missing data scenarios #6492

Closed
opened 2026-03-13 13:01:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6166
Author: @ping-maxwell
Created: 11/21/2025
Status: Merged
Merged: 11/25/2025
Merged by: @Bekacru

Base: canaryHead: chore/join-tests-for-missing-data


📝 Commits (10+)

  • ae089fe chore: more join tests for missing data senarios
  • ba34855 Merge branch 'canary' into chore/join-tests-for-missing-data
  • 14557a6 Merge branch 'canary' into chore/join-tests-for-missing-data
  • 7315fe1 fix: should throw if model not found
  • 6aa850a Merge branch 'canary' into chore/join-tests-for-missing-data
  • b8da01d chore: lint
  • abe1e67 Merge branch 'canary' into chore/join-tests-for-missing-data
  • d833751 Merge branch 'canary' into chore/join-tests-for-missing-data
  • eb92cfb Merge branch 'canary' into chore/join-tests-for-missing-data
  • 15ccf44 Merge branch 'canary' into chore/join-tests-for-missing-data

📊 Changes

3 files changed (+391 additions, -11 deletions)

View changed files

📝 packages/better-auth/src/adapters/create-test-suite.ts (+31 -10)
📝 packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts (+10 -0)
📝 packages/better-auth/src/adapters/tests/basic.ts (+350 -1)

📄 Description

Added more tests to make related to joins regarding how missing data could reflect the output.


Summary by cubic

Expanded test coverage for join queries with missing data. Updated the test harness to fetch a fresh adapter per call so runtime plugin/schema changes are respected, and fixed the Prisma adapter to throw when a model is missing in updateMany/delete.

  • New Tests

    • Base record missing with joins: findOne -> null, findMany -> [].
    • One-to-one joins: missing -> null; present -> object (single and mixed cases).
    • One-to-many joins (sessions): missing -> []; present -> expected items.
    • Mixed joins: correct results when some joins exist and others don’t.
  • Bug Fixes

    • Prisma adapter: updateMany/delete now throw if model not found (with guidance to run prisma generate).

Written for commit 6033237f15. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6166 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 11/21/2025 **Status:** ✅ Merged **Merged:** 11/25/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `chore/join-tests-for-missing-data` --- ### 📝 Commits (10+) - [`ae089fe`](https://github.com/better-auth/better-auth/commit/ae089fe8c6bdc1357bb1e40c85aa1bb663fd2772) chore: more join tests for missing data senarios - [`ba34855`](https://github.com/better-auth/better-auth/commit/ba348558c3663d6ffe9fa53183eac8a4b8063676) Merge branch 'canary' into chore/join-tests-for-missing-data - [`14557a6`](https://github.com/better-auth/better-auth/commit/14557a6d7d53cddded43539be6a465abae3fd447) Merge branch 'canary' into chore/join-tests-for-missing-data - [`7315fe1`](https://github.com/better-auth/better-auth/commit/7315fe1fb697e9a26a5c8610a5116ad2b5438b5f) fix: should throw if model not found - [`6aa850a`](https://github.com/better-auth/better-auth/commit/6aa850a250303d7f6923cbbd655f31da0f01ee5f) Merge branch 'canary' into chore/join-tests-for-missing-data - [`b8da01d`](https://github.com/better-auth/better-auth/commit/b8da01db642e74eb754838670efed5762769b6b1) chore: lint - [`abe1e67`](https://github.com/better-auth/better-auth/commit/abe1e6785506ce9119795ebe1cf0af64cd92ab7a) Merge branch 'canary' into chore/join-tests-for-missing-data - [`d833751`](https://github.com/better-auth/better-auth/commit/d8337512d0c35d9a8c322065d6ebb1647718a276) Merge branch 'canary' into chore/join-tests-for-missing-data - [`eb92cfb`](https://github.com/better-auth/better-auth/commit/eb92cfbaecf9508c35c220f4328c121a2f9d976a) Merge branch 'canary' into chore/join-tests-for-missing-data - [`15ccf44`](https://github.com/better-auth/better-auth/commit/15ccf4400b64640c2bde1c0f01f9a66b592d620d) Merge branch 'canary' into chore/join-tests-for-missing-data ### 📊 Changes **3 files changed** (+391 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/create-test-suite.ts` (+31 -10) 📝 `packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts` (+10 -0) 📝 `packages/better-auth/src/adapters/tests/basic.ts` (+350 -1) </details> ### 📄 Description Added more tests to make related to joins regarding how missing data could reflect the output. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Expanded test coverage for join queries with missing data. Updated the test harness to fetch a fresh adapter per call so runtime plugin/schema changes are respected, and fixed the Prisma adapter to throw when a model is missing in updateMany/delete. - **New Tests** - Base record missing with joins: findOne -> null, findMany -> []. - One-to-one joins: missing -> null; present -> object (single and mixed cases). - One-to-many joins (sessions): missing -> []; present -> expected items. - Mixed joins: correct results when some joins exist and others don’t. - **Bug Fixes** - Prisma adapter: updateMany/delete now throw if model not found (with guidance to run prisma generate). <sup>Written for commit 6033237f1584241c67082702bc1a464238758aa4. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:01:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6492