[PR #5787] [CLOSED] test: remove runWithUser API #23123

Closed
opened 2026-04-15 21:30:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5787
Author: @himself65
Created: 11/5/2025
Status: ❌ Closed

Base: canary ← Head: himself65/2025/11/05/test-refactor


📝 Commits (1)

  • 13a010b test: remove runWithUser API

📊 Changes

5 files changed (+352 additions, -278 deletions)

View changed files

📝 packages/better-auth/src/api/routes/email-verification.test.ts (+4 -2)
📝 packages/better-auth/src/plugins/admin/admin.test.ts (+198 -127)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+142 -147)
📝 packages/better-auth/src/test-utils/index.ts (+8 -1)
📝 packages/better-auth/src/test-utils/test-instance.ts (+0 -1)

📄 Description

Summary by cubic

Refactored test helpers to use runWithUser() instead of signInWithUser() for scoped auth, and updated admin, organization, and email verification tests accordingly. This simplifies header handling and makes permission checks clearer in tests.

  • Refactors
    • Added runWithUser(email, password, fn) in test utils to sign in and pass headers to a callback.
    • Removed signInWithUser from getTestInstance exports.
    • Updated admin and organization tests to wrap calls in runWithUser for non-admin scenarios and invitations.
    • Adjusted email verification test to trigger verification via runWithUser.
    • Minor cleanups around header management and session retrieval.

Written for commit 13a010b79c. 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/5787 **Author:** [@himself65](https://github.com/himself65) **Created:** 11/5/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `himself65/2025/11/05/test-refactor` --- ### 📝 Commits (1) - [`13a010b`](https://github.com/better-auth/better-auth/commit/13a010b79c4b326de013266de6b80bc9d5075e62) test: remove `runWithUser` API ### 📊 Changes **5 files changed** (+352 additions, -278 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/email-verification.test.ts` (+4 -2) 📝 `packages/better-auth/src/plugins/admin/admin.test.ts` (+198 -127) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+142 -147) 📝 `packages/better-auth/src/test-utils/index.ts` (+8 -1) 📝 `packages/better-auth/src/test-utils/test-instance.ts` (+0 -1) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Refactored test helpers to use runWithUser() instead of signInWithUser() for scoped auth, and updated admin, organization, and email verification tests accordingly. This simplifies header handling and makes permission checks clearer in tests. - **Refactors** - Added runWithUser(email, password, fn) in test utils to sign in and pass headers to a callback. - Removed signInWithUser from getTestInstance exports. - Updated admin and organization tests to wrap calls in runWithUser for non-admin scenarios and invitations. - Adjusted email verification test to trigger verification via runWithUser. - Minor cleanups around header management and session retrieval. <sup>Written for commit 13a010b79c4b326de013266de6b80bc9d5075e62. 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-04-15 21:30:12 -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#23123