-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbetter-auth.test.ts
More file actions
45 lines (39 loc) · 1.02 KB
/
better-auth.test.ts
File metadata and controls
45 lines (39 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type {BetterAuthOptions} from "better-auth"
import {runAdapterTest} from "better-auth/adapters/test"
import {toMerged} from "es-toolkit"
import {suite} from "vitest"
import * as entities from "../fixtures/entities/better-auth-test-suite.js"
import {mikroOrmAdapter} from "../../src/adapter.js"
import {createOrm} from "../fixtures/orm.js"
const orm = await createOrm({
entities: Object.values(entities),
refreshOnEachTest: false
})
suite("better-auth tests", async () => {
const baseOptions: BetterAuthOptions = {
user: {
fields: {
email: "email_address"
},
additionalFields: {
test: {
type: "string",
defaultValue: "test"
}
}
},
session: {
modelName: "sessions"
}
}
await runAdapterTest({
async getAdapter(customOptions = {}) {
const adapter = mikroOrmAdapter(orm, {
debugLogs: {
isRunningAdapterTests: true
}
})
return adapter(toMerged(baseOptions, customOptions))
}
})
})