mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 11:24:57 -05:00
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import type { BetterAuthOptions } from "@better-auth/core";
|
|
import { prismaAdapter } from "@better-auth/prisma-adapter";
|
|
import { testAdapter } from "@better-auth/test-utils/adapter";
|
|
import {
|
|
authFlowTestSuite,
|
|
joinsTestSuite,
|
|
normalTestSuite,
|
|
numberIdTestSuite,
|
|
transactionsTestSuite,
|
|
uuidTestSuite,
|
|
} from "../adapter-factory";
|
|
import { generateAuthConfigFile } from "./generate-auth-config";
|
|
import { generatePrismaSchema } from "./generate-prisma-schema";
|
|
import {
|
|
destroyPrismaClient,
|
|
getPrismaClient,
|
|
incrementMigrationCount,
|
|
} from "./get-prisma-client";
|
|
import { pushPrismaSchema } from "./push-prisma-schema";
|
|
|
|
const dialect = "sqlite";
|
|
const { execute } = await testAdapter({
|
|
adapter: async () => {
|
|
const db = await getPrismaClient(dialect);
|
|
return prismaAdapter(db, {
|
|
provider: dialect,
|
|
debugLogs: { isRunningAdapterTests: true },
|
|
});
|
|
},
|
|
runMigrations: async (options: BetterAuthOptions) => {
|
|
const db = await getPrismaClient(dialect);
|
|
const migrationCount = incrementMigrationCount();
|
|
await generateAuthConfigFile(options);
|
|
await generatePrismaSchema(options, db, migrationCount, dialect);
|
|
await pushPrismaSchema(dialect);
|
|
destroyPrismaClient({ migrationCount: migrationCount - 1, dialect });
|
|
},
|
|
tests: [
|
|
normalTestSuite(),
|
|
transactionsTestSuite(),
|
|
authFlowTestSuite(),
|
|
numberIdTestSuite(),
|
|
joinsTestSuite(),
|
|
uuidTestSuite(),
|
|
],
|
|
onFinish: async () => {},
|
|
prefixTests: dialect,
|
|
});
|
|
|
|
execute();
|