Bugs with database adapter test #1280

Closed
opened 2026-03-13 08:31:03 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @widavies on GitHub (May 29, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Run runAdapterTest against one of the built in adapters.

Current vs. Expected behavior

I believe there are two bugs with the runAdapterTest utility:

  • SHOULD_PREFER_GENERATE_ID_IF_PROVIDED should not be run if disableIdGeneration is set to true. For example, I'm working on a Convex adapter and Convex does not allow custom ids and thus cannot accept them.
  • SHOULD_UPDATE_WITH_MULTIPLE_WHERE cannot pass:
    • UPDATE_MODEL updates user's email to updated@email.com
    • Several more tests SHOULD_FIND** run, but do not change the user's email
    • When SHOULD_UPDATE_WITH_MULTIPLE_WHERE runs - there is no user is the database with user.email (user@email.com), as it was already updated to updated@email.com by UPDATE_MODEL, so the test doesn't pass.

Maybe I'm missing something.

What version of Better Auth are you using?

1.2.8

Provide environment information

- OS: Ubuntu Linux x64
- Browser: n/a
- `vitest` w/ `runAdapterTest`

Which area(s) are affected? (Select all that apply)

Other

Auth config (if applicable)


Additional context

No response

Originally created by @widavies on GitHub (May 29, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Run `runAdapterTest` against one of the built in adapters. ### Current vs. Expected behavior I believe there are two bugs with the `runAdapterTest` utility: - `SHOULD_PREFER_GENERATE_ID_IF_PROVIDED` should not be run if `disableIdGeneration` is set to `true`. For example, I'm working on a Convex adapter and Convex does not allow custom ids and thus cannot accept them. - `SHOULD_UPDATE_WITH_MULTIPLE_WHERE` cannot pass: - `UPDATE_MODEL` updates `user`'s email to `updated@email.com` - Several more tests `SHOULD_FIND**` run, but do not change the `user's` email - When `SHOULD_UPDATE_WITH_MULTIPLE_WHERE` runs - there is no user is the database with `user.email` (user@email.com), as it was already updated to `updated@email.com` by `UPDATE_MODEL`, so the test doesn't pass. Maybe I'm missing something. ### What version of Better Auth are you using? 1.2.8 ### Provide environment information ```bash - OS: Ubuntu Linux x64 - Browser: n/a - `vitest` w/ `runAdapterTest` ``` ### Which area(s) are affected? (Select all that apply) Other ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
Author
Owner

@dosubot[bot] commented on GitHub (Aug 28, 2025):

Hi, @widavies. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported two issues with the runAdapterTest utility in Better Auth v1.2.8.
  • The SHOULD_PREFER_GENERATE_ID_IF_PROVIDED test should be skipped when disableIdGeneration is true, as some adapters like Convex disallow custom IDs.
  • The SHOULD_UPDATE_WITH_MULTIPLE_WHERE test fails because earlier tests modify the user's email, causing update queries to miss the original user.
  • You requested clarification or fixes for these test behaviors.
  • No maintainer responses or further activity have been recorded so far.

Next Steps:

  • Please let me know if these issues are still relevant with the latest version of better-auth by commenting on this issue.
  • If I do not hear back within 7 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 28, 2025): Hi, @widavies. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported two issues with the `runAdapterTest` utility in Better Auth v1.2.8. - The `SHOULD_PREFER_GENERATE_ID_IF_PROVIDED` test should be skipped when `disableIdGeneration` is true, as some adapters like Convex disallow custom IDs. - The `SHOULD_UPDATE_WITH_MULTIPLE_WHERE` test fails because earlier tests modify the user's email, causing update queries to miss the original user. - You requested clarification or fixes for these test behaviors. - No maintainer responses or further activity have been recorded so far. **Next Steps:** - Please let me know if these issues are still relevant with the latest version of better-auth by commenting on this issue. - If I do not hear back within 7 days, I will automatically close this issue. Thank you for your understanding and contribution!
Author
Owner

@ping-maxwell commented on GitHub (Aug 29, 2025):

Not all current adapters use the createAdapter so we don't have a very solid way to gather adapter information, for example if you use the createAdapter, you would be aware of disableIdGeneration, but other devs who made adapters that don't use it have no clue what disableIdGeneration is

We do provide ways to disable tests as needed if it doesn't make sense for your case, you should be able to pass them in the adapterTest options if I remember correctly

@ping-maxwell commented on GitHub (Aug 29, 2025): Not all current adapters use the `createAdapter` so we don't have a very solid way to gather adapter information, for example if you use the createAdapter, you would be aware of `disableIdGeneration`, but other devs who made adapters that don't use it have no clue what `disableIdGeneration` is We do provide ways to disable tests as needed if it doesn't make sense for your case, you should be able to pass them in the `adapterTest` options if I remember correctly
Author
Owner

@widavies commented on GitHub (Oct 2, 2025):

@ping-maxwell Thanks, disabling the test works fine for now. I saw @erquhart 's library does this for his Convex adapter, works well.

@widavies commented on GitHub (Oct 2, 2025): @ping-maxwell Thanks, disabling the test works fine for now. I saw @erquhart 's library does this for his Convex adapter, works well.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1280