test: create lib function for getting mocked env variables

This commit is contained in:
2024-06-15 06:01:19 -04:00
parent be2e7ffa98
commit df7e7432da
6 changed files with 51 additions and 35 deletions

View File

@@ -0,0 +1,22 @@
import type { Env } from "~/types/env";
/** Should only be used when it doesn't make sense for 'Bindings' or 'Variables' to be set. Otherwise, use getTestEnv(). */
export function getTestEnvVariables(): Omit<Env, "Bindings" | "Variables"> {
return getTestEnv();
}
export function getTestEnv({
ADMIN_SDK_JSON = '{"clientEmail": "test@test.com"}',
ENABLE_ANIFY = "true",
QSTASH_URL = "https://qstash.com",
TURSO_AUTH_TOKEN = "123",
TURSO_URL = "http://127.0.0.1:3001",
}: Partial<Env> = {}): Env {
return {
ADMIN_SDK_JSON,
ENABLE_ANIFY,
QSTASH_URL,
TURSO_AUTH_TOKEN,
TURSO_URL,
};
}