test(ai-character): 리소스 운영 E2E 보강
This commit is contained in:
17
tests/e2e/api-base-url.ts
Normal file
17
tests/e2e/api-base-url.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
function readDevelopmentApiBaseUrl(): string {
|
||||
const envFile = readFileSync(resolve(process.cwd(), ".env.development"), "utf8");
|
||||
const line = envFile.split("\n").find((entry) => entry.startsWith("VITE_API_BASE_URL="));
|
||||
|
||||
if (line === undefined) {
|
||||
throw new Error("VITE_API_BASE_URL is missing from .env.development");
|
||||
}
|
||||
|
||||
return line.slice("VITE_API_BASE_URL=".length).trim();
|
||||
}
|
||||
|
||||
export const apiBaseUrl = process.env.VITE_API_BASE_URL ?? readDevelopmentApiBaseUrl();
|
||||
Reference in New Issue
Block a user