mirror of
https://github.com/tale/headplane.git
synced 2026-08-28 16:07:07 +00:00
test: add some unit tests for auth methods
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { drizzle } from "drizzle-orm/node-sqlite";
|
||||
import { migrate } from "drizzle-orm/node-sqlite/migrator";
|
||||
|
||||
import { AuthService } from "~/server/web/auth";
|
||||
|
||||
export function createTestAuth() {
|
||||
const db = drizzle(":memory:");
|
||||
migrate(db, { migrationsFolder: "./drizzle" });
|
||||
|
||||
const auth = new AuthService({
|
||||
secret: "test-secret-key-for-unit-tests",
|
||||
db,
|
||||
cookie: {
|
||||
name: "_hp_test",
|
||||
secure: false,
|
||||
maxAge: 3600,
|
||||
},
|
||||
});
|
||||
|
||||
return { auth, db };
|
||||
}
|
||||
Reference in New Issue
Block a user