@better-auth/test-utils 1.5.6 → 1.6.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,297 @@
1
+ import { expect } from "vitest";
2
+ import { createTestSuite } from "@better-auth/test-utils/adapter";
3
+ //#region src/adapter/suites/case-insensitive.ts
4
+ /**
5
+ * Test suite for case-insensitive string operations across adapters.
6
+ * Tests eq, ne, in, not_in, contains, starts_with, ends_with with mode: "insensitive".
7
+ */
8
+ const caseInsensitiveTestSuite = createTestSuite("case-insensitive", {}, (helpers) => {
9
+ const { adapter, insertRandom, generate } = helpers;
10
+ return {
11
+ "findOne - eq with mode insensitive should match regardless of case": async () => {
12
+ const user = await adapter.create({
13
+ model: "user",
14
+ data: {
15
+ ...await generate("user"),
16
+ email: "TestUser@Example.COM",
17
+ name: "CaseTest"
18
+ },
19
+ forceAllowId: true
20
+ });
21
+ const result = await adapter.findOne({
22
+ model: "user",
23
+ where: [{
24
+ field: "email",
25
+ value: "testuser@example.com",
26
+ operator: "eq",
27
+ mode: "insensitive"
28
+ }]
29
+ });
30
+ expect(result).not.toBeNull();
31
+ expect(result?.id).toBe(user.id);
32
+ expect(result?.email).toBe("TestUser@Example.COM");
33
+ },
34
+ "findOne - eq with mode sensitive (default) should not match different case": async () => {
35
+ await adapter.create({
36
+ model: "user",
37
+ data: {
38
+ ...await generate("user"),
39
+ email: "ExactCase@Test.com",
40
+ name: "ExactCase"
41
+ },
42
+ forceAllowId: true
43
+ });
44
+ expect(await adapter.findOne({
45
+ model: "user",
46
+ where: [{
47
+ field: "email",
48
+ value: "exactcase@test.com",
49
+ operator: "eq",
50
+ mode: "sensitive"
51
+ }]
52
+ })).toBeNull();
53
+ },
54
+ "findMany - eq with mode insensitive": async () => {
55
+ const user = await adapter.create({
56
+ model: "user",
57
+ data: {
58
+ ...await generate("user"),
59
+ email: "FindMany@EQ.Test",
60
+ name: "FindManyEQ"
61
+ },
62
+ forceAllowId: true
63
+ });
64
+ const result = await adapter.findMany({
65
+ model: "user",
66
+ where: [{
67
+ field: "email",
68
+ value: "findmany@eq.test",
69
+ operator: "eq",
70
+ mode: "insensitive"
71
+ }]
72
+ });
73
+ expect(result).toHaveLength(1);
74
+ expect(result[0]?.id).toBe(user.id);
75
+ },
76
+ "findMany - ne with mode insensitive": async () => {
77
+ const users = (await insertRandom("user", 3)).map((x) => x[0]);
78
+ const targetEmail = "ExcludeMe@NE.Test";
79
+ const excludeUser = await adapter.create({
80
+ model: "user",
81
+ data: {
82
+ ...await generate("user"),
83
+ email: targetEmail,
84
+ name: "ExcludeMe"
85
+ },
86
+ forceAllowId: true
87
+ });
88
+ const resultIds = (await adapter.findMany({
89
+ model: "user",
90
+ where: [{
91
+ field: "email",
92
+ value: "excludeme@ne.test",
93
+ operator: "ne",
94
+ mode: "insensitive"
95
+ }]
96
+ })).map((u) => u.id);
97
+ expect(resultIds).not.toContain(excludeUser.id);
98
+ expect(resultIds).toContain(users[0].id);
99
+ },
100
+ "findMany - in with mode insensitive": async () => {
101
+ const user = await adapter.create({
102
+ model: "user",
103
+ data: {
104
+ ...await generate("user"),
105
+ email: "InArray@Test.COM",
106
+ name: "InArray"
107
+ },
108
+ forceAllowId: true
109
+ });
110
+ const result = await adapter.findMany({
111
+ model: "user",
112
+ where: [{
113
+ field: "email",
114
+ value: [
115
+ "other@test.com",
116
+ "inarray@test.com",
117
+ "third@test.com"
118
+ ],
119
+ operator: "in",
120
+ mode: "insensitive"
121
+ }]
122
+ });
123
+ expect(result).toHaveLength(1);
124
+ expect(result[0]?.id).toBe(user.id);
125
+ },
126
+ "findMany - not_in with mode insensitive": async () => {
127
+ const users = (await insertRandom("user", 2)).map((x) => x[0]);
128
+ const excludeUser = await adapter.create({
129
+ model: "user",
130
+ data: {
131
+ ...await generate("user"),
132
+ email: "NotIn@Exclude.Test",
133
+ name: "NotIn"
134
+ },
135
+ forceAllowId: true
136
+ });
137
+ const resultIds = (await adapter.findMany({
138
+ model: "user",
139
+ where: [{
140
+ field: "email",
141
+ value: ["notin@exclude.test"],
142
+ operator: "not_in",
143
+ mode: "insensitive"
144
+ }]
145
+ })).map((u) => u.id);
146
+ expect(resultIds).not.toContain(excludeUser.id);
147
+ expect(resultIds).toContain(users[0].id);
148
+ },
149
+ "findMany - contains with mode insensitive": async () => {
150
+ const user = await adapter.create({
151
+ model: "user",
152
+ data: {
153
+ ...await generate("user"),
154
+ email: "prefixCONTAINSsuffix@test.com",
155
+ name: "Contains"
156
+ },
157
+ forceAllowId: true
158
+ });
159
+ const result = await adapter.findMany({
160
+ model: "user",
161
+ where: [{
162
+ field: "email",
163
+ value: "containssuffix",
164
+ operator: "contains",
165
+ mode: "insensitive"
166
+ }]
167
+ });
168
+ expect(result.length).toBeGreaterThanOrEqual(1);
169
+ expect(result.some((u) => u.id === user.id)).toBe(true);
170
+ },
171
+ "findMany - starts_with with mode insensitive": async () => {
172
+ const user = await adapter.create({
173
+ model: "user",
174
+ data: {
175
+ ...await generate("user"),
176
+ email: "STARTSwith@test.com",
177
+ name: "StartsWith"
178
+ },
179
+ forceAllowId: true
180
+ });
181
+ const result = await adapter.findMany({
182
+ model: "user",
183
+ where: [{
184
+ field: "email",
185
+ value: "starts",
186
+ operator: "starts_with",
187
+ mode: "insensitive"
188
+ }]
189
+ });
190
+ expect(result.length).toBeGreaterThanOrEqual(1);
191
+ expect(result.some((u) => u.id === user.id)).toBe(true);
192
+ },
193
+ "findMany - ends_with with mode insensitive": async () => {
194
+ const user = await adapter.create({
195
+ model: "user",
196
+ data: {
197
+ ...await generate("user"),
198
+ email: "user@ENDSWITH.Com",
199
+ name: "EndsWith"
200
+ },
201
+ forceAllowId: true
202
+ });
203
+ const result = await adapter.findMany({
204
+ model: "user",
205
+ where: [{
206
+ field: "email",
207
+ value: "endswith.com",
208
+ operator: "ends_with",
209
+ mode: "insensitive"
210
+ }]
211
+ });
212
+ expect(result.length).toBeGreaterThanOrEqual(1);
213
+ expect(result.some((u) => u.id === user.id)).toBe(true);
214
+ },
215
+ "count - with mode insensitive": async () => {
216
+ await adapter.create({
217
+ model: "user",
218
+ data: {
219
+ ...await generate("user"),
220
+ email: "CountTest@Case.INSENSITIVE",
221
+ name: "CountTest"
222
+ },
223
+ forceAllowId: true
224
+ });
225
+ expect(await adapter.count({
226
+ model: "user",
227
+ where: [{
228
+ field: "email",
229
+ value: "counttest@case.insensitive",
230
+ operator: "eq",
231
+ mode: "insensitive"
232
+ }]
233
+ })).toBeGreaterThanOrEqual(1);
234
+ },
235
+ "update - where with mode insensitive": async () => {
236
+ const user = await adapter.create({
237
+ model: "user",
238
+ data: {
239
+ ...await generate("user"),
240
+ email: "UpdateWhere@Insensitive.Test",
241
+ name: "BeforeUpdate"
242
+ },
243
+ forceAllowId: true
244
+ });
245
+ const result = await adapter.update({
246
+ model: "user",
247
+ where: [{
248
+ field: "email",
249
+ value: "updatewhere@insensitive.test",
250
+ operator: "eq",
251
+ mode: "insensitive"
252
+ }],
253
+ update: { name: "AfterUpdate" }
254
+ });
255
+ expect(result).not.toBeNull();
256
+ expect(result?.name).toBe("AfterUpdate");
257
+ expect(result?.id).toBe(user.id);
258
+ },
259
+ "deleteMany - where with mode insensitive": async () => {
260
+ const keepUser = (await insertRandom("user"))[0];
261
+ const deleteUser = await adapter.create({
262
+ model: "user",
263
+ data: {
264
+ ...await generate("user"),
265
+ email: "DeleteMany@Case.INSENSITIVE",
266
+ name: "ToDelete"
267
+ },
268
+ forceAllowId: true
269
+ });
270
+ await adapter.deleteMany({
271
+ model: "user",
272
+ where: [{
273
+ field: "email",
274
+ value: "deletemany@case.insensitive",
275
+ operator: "eq",
276
+ mode: "insensitive"
277
+ }]
278
+ });
279
+ expect(await adapter.findOne({
280
+ model: "user",
281
+ where: [{
282
+ field: "id",
283
+ value: deleteUser.id
284
+ }]
285
+ })).toBeNull();
286
+ expect(await adapter.findOne({
287
+ model: "user",
288
+ where: [{
289
+ field: "id",
290
+ value: keepUser.id
291
+ }]
292
+ })).not.toBeNull();
293
+ }
294
+ };
295
+ });
296
+ //#endregion
297
+ export { caseInsensitiveTestSuite };
@@ -1,5 +1,6 @@
1
1
  import { authFlowTestSuite } from "./auth-flow.mjs";
2
2
  import { enableJoinTests, getNormalTestSuiteTests, normalTestSuite } from "./basic.mjs";
3
+ import { caseInsensitiveTestSuite } from "./case-insensitive.mjs";
3
4
  import { joinsTestSuite } from "./joins.mjs";
4
5
  import { numberIdTestSuite } from "./number-id.mjs";
5
6
  import { transactionsTestSuite } from "./transactions.mjs";
@@ -4,7 +4,7 @@ import * as better_auth0 from "better-auth";
4
4
 
5
5
  //#region src/adapter/suites/joins.d.ts
6
6
  declare const joinsTestSuite: (options?: {
7
- disableTests?: Partial<Record<"init - tests" | "create - should create a model" | "create - should always return an id" | "create - should return null for nullable foreign keys" | "create - should apply default values to fields" | "findOne - should find a model" | "findOne - should not apply defaultValue if value not found" | "findOne - should find a model using a reference field" | "findOne - should not throw on record not found" | "findOne - should find a model without id" | "findOne - should find a model with join" | "findOne - should find a model with modified field name" | "findOne - should find a model with modified model name" | "findOne - should find a model with additional fields" | "findOne - should select fields" | "findOne - should select fields with one-to-many join" | "findOne - should select fields with one-to-one join" | "findOne - should select fields with multiple joins" | "findOne - should find model with date field" | "findOne - should perform backwards joins" | "findOne - should return an object for one-to-one joins" | "findOne - should return an array for one-to-many joins" | "findOne - should work with both one-to-one and one-to-many joins" | "findOne - should return null for failed base model lookup that has joins" | "findOne - should join a model with modified field name" | "findMany - should find many models" | "findMany - should find many models with date fields" | "findMany - should find many models with join" | "findMany - should find many with join and limit" | "findMany - should select fields" | "findMany - should select fields with one-to-many join" | "findMany - should select fields with one-to-one join" | "findMany - should select fields with multiple joins" | "findMany - should find many with join and offset" | "findMany - should find many with join and sortBy" | "findMany - should find many with join and where clause" | "findMany - should find many with join, where, limit, and offset" | "findMany - should find many with one-to-one join" | "findMany - should find many with both one-to-one and one-to-many joins" | "findMany - should return an empty array when no models are found" | "findMany - should return empty array when base records don't exist with joins" | "findMany - should find many models with starts_with operator" | "findMany - starts_with should not interpret regex patterns" | "findMany - ends_with should not interpret regex patterns" | "findMany - contains should not interpret regex patterns" | "findMany - should find many models with ends_with operator" | "findMany - should find many models with contains operator" | "findMany - should handle multiple where conditions with different operators" | "findMany - should find many models with contains operator (using symbol)" | "findMany - should find many models with eq operator" | "findMany - should find many models with ne operator" | "findMany - should find many models with gt operator" | "findMany - should find many models with gte operator" | "findMany - should find many models with lte operator" | "findMany - should find many models with lt operator" | "findMany - should find many models with in operator" | "findMany - should find many models with not_in operator" | "findMany - should find many models with sortBy" | "findMany - should find many models with limit" | "findMany - should find many models with offset" | "findMany - should find many models with limit and offset" | "findMany - should find many models with sortBy and offset" | "findMany - should find many models with sortBy and limit" | "findMany - should find many models with sortBy and limit and offset" | "findMany - should find many models with sortBy and limit and offset and where" | "update - should update a model" | "updateMany - should update all models when where is empty" | "updateMany - should update many models with a specific where" | "updateMany - should update many models with a multiple where" | "delete - should delete a model" | "delete - should not throw on record not found" | "delete - should delete by non-unique field" | "deleteMany - should delete many models" | "deleteMany - starts_with should not interpret regex patterns" | "deleteMany - ends_with should not interpret regex patterns" | "deleteMany - contains should not interpret regex patterns" | "deleteMany - should delete many models with numeric values" | "deleteMany - should delete many models with boolean values" | "count - should count many models" | "count - should return 0 with no rows to count" | "count - should count with where clause" | "update - should correctly return record when updating a field used in where clause" | "update - should handle updating multiple fields including where clause field" | "update - should work when updated field is not in where clause" | "findOne - backwards join should only return single record not array" | "findMany - backwards join should only return single record not array" | "findOne - backwards join with modified field name (session base, users-table join)" | "findOne - multiple joins should return result even when some joined tables have no matching rows" | "findOne - should be able to perform a limited join" | "findOne - should be able to perform a complex limited join" | "findMany - should be able to perform a limited join" | "findMany - should be able to perform a complex limited join" | "findOne - should return null for one-to-one join when joined record doesn't exist" | "findMany - should return null for one-to-one join when joined records don't exist" | "findMany - should return empty array for one-to-many join when joined records don't exist" | "findMany - should handle mixed joins correctly when some are missing" | "create - should support arrays" | "create - should support json" | "update - should support multiple where conditions under AND connector with unique field", boolean> & {
7
+ disableTests?: Partial<Record<"init - tests" | "create - should create a model" | "create - should always return an id" | "create - should return null for nullable foreign keys" | "create - should apply default values to fields" | "findOne - should find a model" | "findOne - should not apply defaultValue if value not found" | "findOne - should find a model using a reference field" | "findOne - should not throw on record not found" | "findOne - should find a model without id" | "findOne - should find a model with join" | "findOne - should find a model with modified field name" | "findOne - should find a model with modified model name" | "findOne - should find a model with additional fields" | "findOne - should select fields" | "findOne - should select fields with one-to-many join" | "findOne - should select fields with one-to-one join" | "findOne - should select fields with multiple joins" | "findOne - should find model with date field" | "findOne - should perform backwards joins" | "findOne - should return an object for one-to-one joins" | "findOne - should return an array for one-to-many joins" | "findOne - should work with both one-to-one and one-to-many joins" | "findOne - should return null for failed base model lookup that has joins" | "findOne - should join a model with modified field name" | "findMany - should find many models" | "findMany - should find many models with date fields" | "findMany - should find many models with join" | "findMany - should find many with join and limit" | "findMany - should select fields" | "findMany - should select fields with one-to-many join" | "findMany - should select fields with one-to-one join" | "findMany - should select fields with multiple joins" | "findMany - should find many with join and offset" | "findMany - should find many with join and sortBy" | "findMany - should find many with join and where clause" | "findMany - should find many with join, where, limit, and offset" | "findMany - should find many with one-to-one join" | "findMany - should find many with both one-to-one and one-to-many joins" | "findMany - should return an empty array when no models are found" | "findMany - should return empty array when base records don't exist with joins" | "findMany - should find many models with starts_with operator" | "findMany - starts_with should not interpret regex patterns" | "findMany - ends_with should not interpret regex patterns" | "findMany - contains should not interpret regex patterns" | "findMany - should find many models with ends_with operator" | "findMany - should find many models with contains operator" | "findMany - should handle multiple where conditions with different operators" | "findMany - should find many models with contains operator (using symbol)" | "findMany - should find many models with eq operator" | "findMany - should find many models with ne operator" | "findMany - should find many models with gt operator" | "findMany - should find many models with gte operator" | "findMany - should find many models with lte operator" | "findMany - should find many models with lt operator" | "findMany - should find many models with in operator" | "findMany - should find many models with not_in operator" | "findMany - should find many models with sortBy" | "findMany - should find many models with limit" | "findMany - should find many models with offset" | "findMany - should find many models with limit and offset" | "findMany - should find many models with sortBy and offset" | "findMany - should find many models with sortBy and limit" | "findMany - should find many models with sortBy and limit and offset" | "findMany - should find many models with sortBy and limit and offset and where" | "update - should update a model" | "updateMany - should update all models when where is empty" | "updateMany - should update many models with a specific where" | "updateMany - should update many models with a multiple where" | "delete - should delete a model" | "delete - should not throw on record not found" | "delete - should delete by non-unique field" | "deleteMany - should delete many models" | "deleteMany - starts_with should not interpret regex patterns" | "deleteMany - ends_with should not interpret regex patterns" | "deleteMany - contains should not interpret regex patterns" | "deleteMany - should delete many models with numeric values" | "deleteMany - should delete many models with boolean values" | "count - should count many models" | "count - should return 0 with no rows to count" | "count - should count with where clause" | "update - should correctly return record when updating a field used in where clause" | "update - should handle updating multiple fields including where clause field" | "update - should work when updated field is not in where clause" | "findOne - backwards join should only return single record not array" | "findMany - backwards join should only return single record not array" | "findOne - backwards join with modified field name (session base, users-table join)" | "findOne - multiple joins should return result even when some joined tables have no matching rows" | "findOne - should be able to perform a limited join" | "findOne - should be able to perform a complex limited join" | "findMany - should be able to perform a limited join" | "findMany - should be able to perform a complex limited join" | "findOne - should return null for one-to-one join when joined record doesn't exist" | "findMany - should return null for one-to-one join when joined records don't exist" | "findMany - should return empty array for one-to-many join when joined records don't exist" | "findMany - should handle mixed joins correctly when some are missing" | "create - should support arrays" | "create - should support json" | "update - should support multiple where conditions under AND connector with unique field" | "findMany - eq operator with null value (single condition) should use IS NULL" | "findMany - eq and ne operators with null value in AND group should use IS NULL / IS NOT NULL" | "findMany - eq and ne operators with null value in OR group should use IS NULL / IS NOT NULL" | "update - should return updated record when where condition uses null value", boolean> & {
8
8
  ALL?: boolean;
9
9
  }> | undefined;
10
10
  } | undefined) => (helpers: {
@@ -21,5 +21,4 @@ declare const joinsTestSuite: (options?: {
21
21
  transformIdOutput?: ((id: any) => string | undefined) | undefined;
22
22
  }) => Promise<void>;
23
23
  //#endregion
24
- export { joinsTestSuite };
25
- //# sourceMappingURL=joins.d.mts.map
24
+ export { joinsTestSuite };
@@ -1,7 +1,6 @@
1
1
  import { createTestSuite } from "../create-test-suite.mjs";
2
2
  import { getNormalTestSuiteTests } from "./basic.mjs";
3
3
  import { expect } from "vitest";
4
-
5
4
  //#region src/adapter/suites/joins.ts
6
5
  const joinsTestSuite = createTestSuite("joins", {
7
6
  defaultBetterAuthOptions: { experimental: { joins: true } },
@@ -16,7 +15,5 @@ const joinsTestSuite = createTestSuite("joins", {
16
15
  ...normalTests
17
16
  };
18
17
  });
19
-
20
18
  //#endregion
21
19
  export { joinsTestSuite };
22
- //# sourceMappingURL=joins.mjs.map
@@ -4,7 +4,7 @@ import * as better_auth0 from "better-auth";
4
4
 
5
5
  //#region src/adapter/suites/number-id.d.ts
6
6
  declare const numberIdTestSuite: (options?: {
7
- disableTests?: Partial<Record<"init - tests" | "create - should create a model" | "create - should always return an id" | "create - should return null for nullable foreign keys" | "create - should apply default values to fields" | "findOne - should find a model" | "findOne - should not apply defaultValue if value not found" | "findOne - should find a model using a reference field" | "findOne - should not throw on record not found" | "findOne - should find a model without id" | "findOne - should find a model with join" | "findOne - should find a model with modified field name" | "findOne - should find a model with modified model name" | "findOne - should find a model with additional fields" | "findOne - should select fields" | "findOne - should select fields with one-to-many join" | "findOne - should select fields with one-to-one join" | "findOne - should select fields with multiple joins" | "findOne - should find model with date field" | "findOne - should perform backwards joins" | "findOne - should return an object for one-to-one joins" | "findOne - should return an array for one-to-many joins" | "findOne - should work with both one-to-one and one-to-many joins" | "findOne - should return null for failed base model lookup that has joins" | "findOne - should join a model with modified field name" | "findMany - should find many models" | "findMany - should find many models with date fields" | "findMany - should find many models with join" | "findMany - should find many with join and limit" | "findMany - should select fields" | "findMany - should select fields with one-to-many join" | "findMany - should select fields with one-to-one join" | "findMany - should select fields with multiple joins" | "findMany - should find many with join and offset" | "findMany - should find many with join and sortBy" | "findMany - should find many with join and where clause" | "findMany - should find many with join, where, limit, and offset" | "findMany - should find many with one-to-one join" | "findMany - should find many with both one-to-one and one-to-many joins" | "findMany - should return an empty array when no models are found" | "findMany - should return empty array when base records don't exist with joins" | "findMany - should find many models with starts_with operator" | "findMany - starts_with should not interpret regex patterns" | "findMany - ends_with should not interpret regex patterns" | "findMany - contains should not interpret regex patterns" | "findMany - should find many models with ends_with operator" | "findMany - should find many models with contains operator" | "findMany - should handle multiple where conditions with different operators" | "findMany - should find many models with contains operator (using symbol)" | "findMany - should find many models with eq operator" | "findMany - should find many models with ne operator" | "findMany - should find many models with gt operator" | "findMany - should find many models with gte operator" | "findMany - should find many models with lte operator" | "findMany - should find many models with lt operator" | "findMany - should find many models with in operator" | "findMany - should find many models with not_in operator" | "findMany - should find many models with sortBy" | "findMany - should find many models with limit" | "findMany - should find many models with offset" | "findMany - should find many models with limit and offset" | "findMany - should find many models with sortBy and offset" | "findMany - should find many models with sortBy and limit" | "findMany - should find many models with sortBy and limit and offset" | "findMany - should find many models with sortBy and limit and offset and where" | "update - should update a model" | "updateMany - should update all models when where is empty" | "updateMany - should update many models with a specific where" | "updateMany - should update many models with a multiple where" | "delete - should delete a model" | "delete - should not throw on record not found" | "delete - should delete by non-unique field" | "deleteMany - should delete many models" | "deleteMany - starts_with should not interpret regex patterns" | "deleteMany - ends_with should not interpret regex patterns" | "deleteMany - contains should not interpret regex patterns" | "deleteMany - should delete many models with numeric values" | "deleteMany - should delete many models with boolean values" | "count - should count many models" | "count - should return 0 with no rows to count" | "count - should count with where clause" | "update - should correctly return record when updating a field used in where clause" | "update - should handle updating multiple fields including where clause field" | "update - should work when updated field is not in where clause" | "findOne - backwards join should only return single record not array" | "findMany - backwards join should only return single record not array" | "findOne - backwards join with modified field name (session base, users-table join)" | "findOne - multiple joins should return result even when some joined tables have no matching rows" | "findOne - should be able to perform a limited join" | "findOne - should be able to perform a complex limited join" | "findMany - should be able to perform a limited join" | "findMany - should be able to perform a complex limited join" | "findOne - should return null for one-to-one join when joined record doesn't exist" | "findMany - should return null for one-to-one join when joined records don't exist" | "findMany - should return empty array for one-to-many join when joined records don't exist" | "findMany - should handle mixed joins correctly when some are missing" | "create - should support arrays" | "create - should support json" | "update - should support multiple where conditions under AND connector with unique field" | "create - should return a number id", boolean> & {
7
+ disableTests?: Partial<Record<"init - tests" | "create - should create a model" | "create - should always return an id" | "create - should return null for nullable foreign keys" | "create - should apply default values to fields" | "findOne - should find a model" | "findOne - should not apply defaultValue if value not found" | "findOne - should find a model using a reference field" | "findOne - should not throw on record not found" | "findOne - should find a model without id" | "findOne - should find a model with join" | "findOne - should find a model with modified field name" | "findOne - should find a model with modified model name" | "findOne - should find a model with additional fields" | "findOne - should select fields" | "findOne - should select fields with one-to-many join" | "findOne - should select fields with one-to-one join" | "findOne - should select fields with multiple joins" | "findOne - should find model with date field" | "findOne - should perform backwards joins" | "findOne - should return an object for one-to-one joins" | "findOne - should return an array for one-to-many joins" | "findOne - should work with both one-to-one and one-to-many joins" | "findOne - should return null for failed base model lookup that has joins" | "findOne - should join a model with modified field name" | "findMany - should find many models" | "findMany - should find many models with date fields" | "findMany - should find many models with join" | "findMany - should find many with join and limit" | "findMany - should select fields" | "findMany - should select fields with one-to-many join" | "findMany - should select fields with one-to-one join" | "findMany - should select fields with multiple joins" | "findMany - should find many with join and offset" | "findMany - should find many with join and sortBy" | "findMany - should find many with join and where clause" | "findMany - should find many with join, where, limit, and offset" | "findMany - should find many with one-to-one join" | "findMany - should find many with both one-to-one and one-to-many joins" | "findMany - should return an empty array when no models are found" | "findMany - should return empty array when base records don't exist with joins" | "findMany - should find many models with starts_with operator" | "findMany - starts_with should not interpret regex patterns" | "findMany - ends_with should not interpret regex patterns" | "findMany - contains should not interpret regex patterns" | "findMany - should find many models with ends_with operator" | "findMany - should find many models with contains operator" | "findMany - should handle multiple where conditions with different operators" | "findMany - should find many models with contains operator (using symbol)" | "findMany - should find many models with eq operator" | "findMany - should find many models with ne operator" | "findMany - should find many models with gt operator" | "findMany - should find many models with gte operator" | "findMany - should find many models with lte operator" | "findMany - should find many models with lt operator" | "findMany - should find many models with in operator" | "findMany - should find many models with not_in operator" | "findMany - should find many models with sortBy" | "findMany - should find many models with limit" | "findMany - should find many models with offset" | "findMany - should find many models with limit and offset" | "findMany - should find many models with sortBy and offset" | "findMany - should find many models with sortBy and limit" | "findMany - should find many models with sortBy and limit and offset" | "findMany - should find many models with sortBy and limit and offset and where" | "update - should update a model" | "updateMany - should update all models when where is empty" | "updateMany - should update many models with a specific where" | "updateMany - should update many models with a multiple where" | "delete - should delete a model" | "delete - should not throw on record not found" | "delete - should delete by non-unique field" | "deleteMany - should delete many models" | "deleteMany - starts_with should not interpret regex patterns" | "deleteMany - ends_with should not interpret regex patterns" | "deleteMany - contains should not interpret regex patterns" | "deleteMany - should delete many models with numeric values" | "deleteMany - should delete many models with boolean values" | "count - should count many models" | "count - should return 0 with no rows to count" | "count - should count with where clause" | "update - should correctly return record when updating a field used in where clause" | "update - should handle updating multiple fields including where clause field" | "update - should work when updated field is not in where clause" | "findOne - backwards join should only return single record not array" | "findMany - backwards join should only return single record not array" | "findOne - backwards join with modified field name (session base, users-table join)" | "findOne - multiple joins should return result even when some joined tables have no matching rows" | "findOne - should be able to perform a limited join" | "findOne - should be able to perform a complex limited join" | "findMany - should be able to perform a limited join" | "findMany - should be able to perform a complex limited join" | "findOne - should return null for one-to-one join when joined record doesn't exist" | "findMany - should return null for one-to-one join when joined records don't exist" | "findMany - should return empty array for one-to-many join when joined records don't exist" | "findMany - should handle mixed joins correctly when some are missing" | "create - should support arrays" | "create - should support json" | "update - should support multiple where conditions under AND connector with unique field" | "findMany - eq operator with null value (single condition) should use IS NULL" | "findMany - eq and ne operators with null value in AND group should use IS NULL / IS NOT NULL" | "findMany - eq and ne operators with null value in OR group should use IS NULL / IS NOT NULL" | "update - should return updated record when where condition uses null value" | "create - should return a number id", boolean> & {
8
8
  ALL?: boolean;
9
9
  }> | undefined;
10
10
  } | undefined) => (helpers: {
@@ -21,5 +21,4 @@ declare const numberIdTestSuite: (options?: {
21
21
  transformIdOutput?: ((id: any) => string | undefined) | undefined;
22
22
  }) => Promise<void>;
23
23
  //#endregion
24
- export { numberIdTestSuite };
25
- //# sourceMappingURL=number-id.d.mts.map
24
+ export { numberIdTestSuite };
@@ -1,7 +1,6 @@
1
1
  import { createTestSuite } from "../create-test-suite.mjs";
2
2
  import { getNormalTestSuiteTests } from "./basic.mjs";
3
3
  import { expect } from "vitest";
4
-
5
4
  //#region src/adapter/suites/number-id.ts
6
5
  const numberIdTestSuite = createTestSuite("number-id", {
7
6
  defaultBetterAuthOptions: { advanced: { database: { generateId: "serial" } } },
@@ -27,7 +26,5 @@ const numberIdTestSuite = createTestSuite("number-id", {
27
26
  ...normalTests
28
27
  };
29
28
  });
30
-
31
29
  //#endregion
32
30
  export { numberIdTestSuite };
33
- //# sourceMappingURL=number-id.mjs.map
@@ -24,5 +24,4 @@ declare const transactionsTestSuite: (options?: {
24
24
  transformIdOutput?: ((id: any) => string | undefined) | undefined;
25
25
  }) => Promise<void>;
26
26
  //#endregion
27
- export { transactionsTestSuite };
28
- //# sourceMappingURL=transactions.d.mts.map
27
+ export { transactionsTestSuite };
@@ -1,6 +1,5 @@
1
1
  import { createTestSuite } from "../create-test-suite.mjs";
2
2
  import { expect } from "vitest";
3
-
4
3
  //#region src/adapter/suites/transactions.ts
5
4
  /**
6
5
  * This test suite tests the transaction functionality of the adapter.
@@ -25,7 +24,5 @@ const transactionsTestSuite = createTestSuite("transactions", {}, ({ adapter, ge
25
24
  await hardCleanup();
26
25
  expect(result.length).toBe(0);
27
26
  } }));
28
-
29
27
  //#endregion
30
28
  export { transactionsTestSuite };
31
- //# sourceMappingURL=transactions.mjs.map
@@ -4,7 +4,7 @@ import * as better_auth0 from "better-auth";
4
4
 
5
5
  //#region src/adapter/suites/uuid.d.ts
6
6
  declare const uuidTestSuite: (options?: {
7
- disableTests?: Partial<Record<"init - tests" | "create - should create a model" | "create - should always return an id" | "create - should return null for nullable foreign keys" | "create - should apply default values to fields" | "findOne - should find a model" | "findOne - should not apply defaultValue if value not found" | "findOne - should find a model using a reference field" | "findOne - should not throw on record not found" | "findOne - should find a model without id" | "findOne - should find a model with join" | "findOne - should find a model with modified field name" | "findOne - should find a model with modified model name" | "findOne - should find a model with additional fields" | "findOne - should select fields" | "findOne - should select fields with one-to-many join" | "findOne - should select fields with one-to-one join" | "findOne - should select fields with multiple joins" | "findOne - should find model with date field" | "findOne - should perform backwards joins" | "findOne - should return an object for one-to-one joins" | "findOne - should return an array for one-to-many joins" | "findOne - should work with both one-to-one and one-to-many joins" | "findOne - should return null for failed base model lookup that has joins" | "findOne - should join a model with modified field name" | "findMany - should find many models" | "findMany - should find many models with date fields" | "findMany - should find many models with join" | "findMany - should find many with join and limit" | "findMany - should select fields" | "findMany - should select fields with one-to-many join" | "findMany - should select fields with one-to-one join" | "findMany - should select fields with multiple joins" | "findMany - should find many with join and offset" | "findMany - should find many with join and sortBy" | "findMany - should find many with join and where clause" | "findMany - should find many with join, where, limit, and offset" | "findMany - should find many with one-to-one join" | "findMany - should find many with both one-to-one and one-to-many joins" | "findMany - should return an empty array when no models are found" | "findMany - should return empty array when base records don't exist with joins" | "findMany - should find many models with starts_with operator" | "findMany - starts_with should not interpret regex patterns" | "findMany - ends_with should not interpret regex patterns" | "findMany - contains should not interpret regex patterns" | "findMany - should find many models with ends_with operator" | "findMany - should find many models with contains operator" | "findMany - should handle multiple where conditions with different operators" | "findMany - should find many models with contains operator (using symbol)" | "findMany - should find many models with eq operator" | "findMany - should find many models with ne operator" | "findMany - should find many models with gt operator" | "findMany - should find many models with gte operator" | "findMany - should find many models with lte operator" | "findMany - should find many models with lt operator" | "findMany - should find many models with in operator" | "findMany - should find many models with not_in operator" | "findMany - should find many models with sortBy" | "findMany - should find many models with limit" | "findMany - should find many models with offset" | "findMany - should find many models with limit and offset" | "findMany - should find many models with sortBy and offset" | "findMany - should find many models with sortBy and limit" | "findMany - should find many models with sortBy and limit and offset" | "findMany - should find many models with sortBy and limit and offset and where" | "update - should update a model" | "updateMany - should update all models when where is empty" | "updateMany - should update many models with a specific where" | "updateMany - should update many models with a multiple where" | "delete - should delete a model" | "delete - should not throw on record not found" | "delete - should delete by non-unique field" | "deleteMany - should delete many models" | "deleteMany - starts_with should not interpret regex patterns" | "deleteMany - ends_with should not interpret regex patterns" | "deleteMany - contains should not interpret regex patterns" | "deleteMany - should delete many models with numeric values" | "deleteMany - should delete many models with boolean values" | "count - should count many models" | "count - should return 0 with no rows to count" | "count - should count with where clause" | "update - should correctly return record when updating a field used in where clause" | "update - should handle updating multiple fields including where clause field" | "update - should work when updated field is not in where clause" | "findOne - backwards join should only return single record not array" | "findMany - backwards join should only return single record not array" | "findOne - backwards join with modified field name (session base, users-table join)" | "findOne - multiple joins should return result even when some joined tables have no matching rows" | "findOne - should be able to perform a limited join" | "findOne - should be able to perform a complex limited join" | "findMany - should be able to perform a limited join" | "findMany - should be able to perform a complex limited join" | "findOne - should return null for one-to-one join when joined record doesn't exist" | "findMany - should return null for one-to-one join when joined records don't exist" | "findMany - should return empty array for one-to-many join when joined records don't exist" | "findMany - should handle mixed joins correctly when some are missing" | "create - should support arrays" | "create - should support json" | "update - should support multiple where conditions under AND connector with unique field" | "create - should return a uuid" | "findOne - should find a model using a uuid", boolean> & {
7
+ disableTests?: Partial<Record<"init - tests" | "create - should create a model" | "create - should always return an id" | "create - should return null for nullable foreign keys" | "create - should apply default values to fields" | "findOne - should find a model" | "findOne - should not apply defaultValue if value not found" | "findOne - should find a model using a reference field" | "findOne - should not throw on record not found" | "findOne - should find a model without id" | "findOne - should find a model with join" | "findOne - should find a model with modified field name" | "findOne - should find a model with modified model name" | "findOne - should find a model with additional fields" | "findOne - should select fields" | "findOne - should select fields with one-to-many join" | "findOne - should select fields with one-to-one join" | "findOne - should select fields with multiple joins" | "findOne - should find model with date field" | "findOne - should perform backwards joins" | "findOne - should return an object for one-to-one joins" | "findOne - should return an array for one-to-many joins" | "findOne - should work with both one-to-one and one-to-many joins" | "findOne - should return null for failed base model lookup that has joins" | "findOne - should join a model with modified field name" | "findMany - should find many models" | "findMany - should find many models with date fields" | "findMany - should find many models with join" | "findMany - should find many with join and limit" | "findMany - should select fields" | "findMany - should select fields with one-to-many join" | "findMany - should select fields with one-to-one join" | "findMany - should select fields with multiple joins" | "findMany - should find many with join and offset" | "findMany - should find many with join and sortBy" | "findMany - should find many with join and where clause" | "findMany - should find many with join, where, limit, and offset" | "findMany - should find many with one-to-one join" | "findMany - should find many with both one-to-one and one-to-many joins" | "findMany - should return an empty array when no models are found" | "findMany - should return empty array when base records don't exist with joins" | "findMany - should find many models with starts_with operator" | "findMany - starts_with should not interpret regex patterns" | "findMany - ends_with should not interpret regex patterns" | "findMany - contains should not interpret regex patterns" | "findMany - should find many models with ends_with operator" | "findMany - should find many models with contains operator" | "findMany - should handle multiple where conditions with different operators" | "findMany - should find many models with contains operator (using symbol)" | "findMany - should find many models with eq operator" | "findMany - should find many models with ne operator" | "findMany - should find many models with gt operator" | "findMany - should find many models with gte operator" | "findMany - should find many models with lte operator" | "findMany - should find many models with lt operator" | "findMany - should find many models with in operator" | "findMany - should find many models with not_in operator" | "findMany - should find many models with sortBy" | "findMany - should find many models with limit" | "findMany - should find many models with offset" | "findMany - should find many models with limit and offset" | "findMany - should find many models with sortBy and offset" | "findMany - should find many models with sortBy and limit" | "findMany - should find many models with sortBy and limit and offset" | "findMany - should find many models with sortBy and limit and offset and where" | "update - should update a model" | "updateMany - should update all models when where is empty" | "updateMany - should update many models with a specific where" | "updateMany - should update many models with a multiple where" | "delete - should delete a model" | "delete - should not throw on record not found" | "delete - should delete by non-unique field" | "deleteMany - should delete many models" | "deleteMany - starts_with should not interpret regex patterns" | "deleteMany - ends_with should not interpret regex patterns" | "deleteMany - contains should not interpret regex patterns" | "deleteMany - should delete many models with numeric values" | "deleteMany - should delete many models with boolean values" | "count - should count many models" | "count - should return 0 with no rows to count" | "count - should count with where clause" | "update - should correctly return record when updating a field used in where clause" | "update - should handle updating multiple fields including where clause field" | "update - should work when updated field is not in where clause" | "findOne - backwards join should only return single record not array" | "findMany - backwards join should only return single record not array" | "findOne - backwards join with modified field name (session base, users-table join)" | "findOne - multiple joins should return result even when some joined tables have no matching rows" | "findOne - should be able to perform a limited join" | "findOne - should be able to perform a complex limited join" | "findMany - should be able to perform a limited join" | "findMany - should be able to perform a complex limited join" | "findOne - should return null for one-to-one join when joined record doesn't exist" | "findMany - should return null for one-to-one join when joined records don't exist" | "findMany - should return empty array for one-to-many join when joined records don't exist" | "findMany - should handle mixed joins correctly when some are missing" | "create - should support arrays" | "create - should support json" | "update - should support multiple where conditions under AND connector with unique field" | "findMany - eq operator with null value (single condition) should use IS NULL" | "findMany - eq and ne operators with null value in AND group should use IS NULL / IS NOT NULL" | "findMany - eq and ne operators with null value in OR group should use IS NULL / IS NOT NULL" | "update - should return updated record when where condition uses null value" | "create - should return a uuid" | "findOne - should find a model using a uuid", boolean> & {
8
8
  ALL?: boolean;
9
9
  }> | undefined;
10
10
  } | undefined) => (helpers: {
@@ -21,5 +21,4 @@ declare const uuidTestSuite: (options?: {
21
21
  transformIdOutput?: ((id: any) => string | undefined) | undefined;
22
22
  }) => Promise<void>;
23
23
  //#endregion
24
- export { uuidTestSuite };
25
- //# sourceMappingURL=uuid.d.mts.map
24
+ export { uuidTestSuite };
@@ -1,7 +1,6 @@
1
1
  import { createTestSuite } from "../create-test-suite.mjs";
2
2
  import { getNormalTestSuiteTests } from "./basic.mjs";
3
3
  import { expect } from "vitest";
4
-
5
4
  //#region src/adapter/suites/uuid.ts
6
5
  const uuidTestSuite = createTestSuite("uuid", {
7
6
  defaultBetterAuthOptions: { advanced: { database: { generateId: "uuid" } } },
@@ -49,7 +48,5 @@ const uuidTestSuite = createTestSuite("uuid", {
49
48
  ...normalTests
50
49
  };
51
50
  });
52
-
53
51
  //#endregion
54
52
  export { uuidTestSuite };
55
- //# sourceMappingURL=uuid.mjs.map
@@ -72,5 +72,4 @@ declare const testAdapter: ({
72
72
  execute: () => void;
73
73
  }>;
74
74
  //#endregion
75
- export { Logger, testAdapter };
76
- //# sourceMappingURL=test-adapter.d.mts.map
75
+ export { Logger, testAdapter };
@@ -2,7 +2,6 @@ import { deepmerge, initGetModelName } from "@better-auth/core/db/adapter";
2
2
  import { TTY_COLORS } from "@better-auth/core/env";
3
3
  import { afterAll, beforeAll, describe } from "vitest";
4
4
  import { getAuthTables } from "better-auth/db";
5
-
6
5
  //#region src/adapter/test-adapter.ts
7
6
  const testAdapter = async ({ adapter: getAdapter, runMigrations, overrideBetterAuthOptions, additionalCleanups, tests, prefixTests, onFinish, customIdGenerator, transformIdOutput }) => {
8
7
  const defaultBAOptions = {};
@@ -157,7 +156,5 @@ const testAdapter = async ({ adapter: getAdapter, runMigrations, overrideBetterA
157
156
  });
158
157
  } };
159
158
  };
160
-
161
159
  //#endregion
162
160
  export { testAdapter };
163
- //# sourceMappingURL=test-adapter.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/test-utils",
3
- "version": "1.5.6",
3
+ "version": "1.6.0-beta.0",
4
4
  "description": "Testing utilities for Better Auth adapter development",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
+ "sideEffects": false,
22
23
  "files": [
23
24
  "dist"
24
25
  ],
@@ -30,15 +31,15 @@
30
31
  }
31
32
  },
32
33
  "devDependencies": {
33
- "tsdown": "0.21.0-beta.2",
34
+ "tsdown": "0.21.1",
34
35
  "vitest": "^4.0.18",
35
- "@better-auth/core": "1.5.6",
36
- "better-auth": "1.5.6"
36
+ "@better-auth/core": "1.6.0-beta.0",
37
+ "better-auth": "1.6.0-beta.0"
37
38
  },
38
39
  "peerDependencies": {
39
40
  "vitest": "^4.0.18",
40
- "@better-auth/core": "1.5.6",
41
- "better-auth": "1.5.6"
41
+ "better-auth": "^1.6.0-beta.0",
42
+ "@better-auth/core": "^1.6.0-beta.0"
42
43
  },
43
44
  "scripts": {
44
45
  "build": "tsdown",