Introduce test environment constants
cgen-00bb749c34c44a2abe18c61f85704386
This commit is contained in:
parent
5d195533cf
commit
dfa13a0b3e
1 changed files with 5 additions and 4 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import { supabase, isSupabaseConfigured } from "@/lib/supabase";
|
import { supabase, isSupabaseConfigured } from "@/lib/supabase";
|
||||||
import type { Database } from "./database.types";
|
import type { Database } from "./database.types";
|
||||||
|
import { mockAuth } from "./mock-auth";
|
||||||
|
|
||||||
// Use the existing database user profile type directly
|
// Use the existing database user profile type directly
|
||||||
import type { UserProfile } from "./database.types";
|
import type { UserProfile } from "./database.types";
|
||||||
|
|
@ -23,12 +24,12 @@ export interface AethexUserProfile extends UserProfile {
|
||||||
const isNonEmptyString = (value: unknown): value is string =>
|
const isNonEmptyString = (value: unknown): value is string =>
|
||||||
typeof value === "string" && value.trim().length > 0;
|
typeof value === "string" && value.trim().length > 0;
|
||||||
|
|
||||||
|
const isTestEnvironment =
|
||||||
|
typeof process !== "undefined" &&
|
||||||
|
(process.env?.NODE_ENV === "test" || process.env?.VITEST);
|
||||||
|
|
||||||
const ensureSupabase = () => {
|
const ensureSupabase = () => {
|
||||||
if (!isSupabaseConfigured) {
|
if (!isSupabaseConfigured) {
|
||||||
const isTestEnvironment =
|
|
||||||
typeof process !== "undefined" &&
|
|
||||||
(process.env?.NODE_ENV === "test" || process.env?.VITEST);
|
|
||||||
|
|
||||||
if (isTestEnvironment) {
|
if (isTestEnvironment) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue