mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-03 12:57:09 -05:00
fix: typecheck
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
"typescript": "5.5.0-dev.20240520"
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
"pre-commit": "pnpm format && pnpm lint:fix"
|
||||
"pre-commit": "pnpm typecheck && pnpm format && pnpm lint:fix"
|
||||
},
|
||||
"devDependencies": {
|
||||
"simple-git-hooks": "^2.11.1"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { MissingSecret } from "@better-auth/shared/error";
|
||||
|
||||
export const DEFAULT_SECRET = "better-auth-secret-key-123456789";
|
||||
export const getSecret = (secret?: string) => {
|
||||
secret = secret || process.env.BETTER_AUTH_SECRET || process.env.AUTH_SECRET;
|
||||
const defaultSecret = "better-auth-secret-key-123456789";
|
||||
if (process.env.NODE_ENV === "production" && !secret) {
|
||||
throw new MissingSecret();
|
||||
}
|
||||
return secret || defaultSecret;
|
||||
return secret || DEFAULT_SECRET;
|
||||
};
|
||||
|
||||
@@ -54,10 +54,6 @@ describe("to context", async () => {
|
||||
const options: BetterAuthOptions = {
|
||||
providers: [],
|
||||
adapter: memoryAdapter({}),
|
||||
pages: {
|
||||
signIn: "/",
|
||||
signUp: "/",
|
||||
},
|
||||
user: {
|
||||
fields: {
|
||||
email: { type: "string", required: true },
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { BetterAuthOptions } from "../src/options";
|
||||
import { credential } from "../src/providers";
|
||||
import { github } from "../src/providers/github";
|
||||
import { getH3Server } from "./utils/server";
|
||||
import { DEFAULT_SECRET } from "../src/utils/secret";
|
||||
|
||||
describe("signin handler", async (it) => {
|
||||
const db = {
|
||||
@@ -14,7 +15,7 @@ describe("signin handler", async (it) => {
|
||||
{
|
||||
id: "1234",
|
||||
email: "test@email.com",
|
||||
password: await hashPassword("test"),
|
||||
password: await hashPassword("test", DEFAULT_SECRET),
|
||||
firstName: "Test",
|
||||
lastName: "User",
|
||||
},
|
||||
|
||||
@@ -6,6 +6,7 @@ import { hashPassword } from "../src/crypto/password";
|
||||
import { credential } from "../src/providers";
|
||||
import { github } from "../src/providers/github";
|
||||
import { getH3Server } from "./utils/server";
|
||||
import { DEFAULT_SECRET } from "../src/utils/secret";
|
||||
|
||||
describe("signin handler", async (it) => {
|
||||
const db = {
|
||||
@@ -13,7 +14,7 @@ describe("signin handler", async (it) => {
|
||||
{
|
||||
id: "1234",
|
||||
email: "test@email.com",
|
||||
password: await hashPassword("test"),
|
||||
password: await hashPassword("test", DEFAULT_SECRET),
|
||||
firstName: "Test",
|
||||
lastName: "User",
|
||||
},
|
||||
|
||||
@@ -130,10 +130,10 @@ describe("Signup", async () => {
|
||||
});
|
||||
|
||||
it("should verify email", async () => {
|
||||
expect(db.user[0].emailVerified).toBe(false);
|
||||
expect(db.user[0]?.emailVerified).toBe(false);
|
||||
const response = await app.request(verifyEmailUrl);
|
||||
const redirectedLocation = response.headers.get("Location");
|
||||
expect(db.user[0].emailVerified).toBe(true);
|
||||
expect(db.user[0]?.emailVerified).toBe(true);
|
||||
expect(response.status).toBe(302);
|
||||
expect(redirectedLocation).toBe("http://localhost:4002");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user