CI빌드 오류 수정
CI / test (push) Successful in 4m48s
CI / e2e (push) Has been skipped
CI / pr_and_merge (push) Successful in 1m13s

This commit is contained in:
2025-12-07 10:12:38 +09:00
parent a5b432fb7b
commit 4902a0b5a9
5 changed files with 22 additions and 15 deletions
+7 -12
View File
@@ -98,8 +98,7 @@ describe("/api/forms/submit", () => {
// fetch 를 목킹하여 payload 와 헤더가 기대대로 전달되는지 검증한다.
const fetchMock = vi.fn(async () => new Response("ok", { status: 200 }));
// @ts-expect-error - 글로벌 fetch 재정의
global.fetch = fetchMock;
(globalThis as any).fetch = fetchMock;
const formData = new FormData();
formData.append("email_address", "test@example.com");
@@ -119,7 +118,7 @@ describe("/api/forms/submit", () => {
expect(json.ok).toBe(true);
expect(fetchMock).toHaveBeenCalledTimes(1);
const [url, options] = fetchMock.mock.calls[0] as [string, RequestInit];
const [url, options] = fetchMock.mock.calls[0] as unknown as [string, RequestInit];
expect(url).toBe(destinationUrl);
expect(options.method).toBe("POST");
expect(options.headers).toMatchObject({
@@ -152,8 +151,7 @@ describe("/api/forms/submit", () => {
};
const fetchMock = vi.fn(async () => new Response("ok", { status: 200 }));
// @ts-expect-error - 글로벌 fetch 재정의
global.fetch = fetchMock;
(globalThis as any).fetch = fetchMock;
const formData = new FormData();
formData.append("email_address", "json@example.com");
@@ -206,8 +204,7 @@ describe("/api/forms/submit", () => {
};
const fetchMock = vi.fn(async () => new Response("ok", { status: 200 }));
// @ts-expect-error - 글로벌 fetch 재정의
global.fetch = fetchMock;
(globalThis as any).fetch = fetchMock;
const formData = new FormData();
formData.append("email_address", "success-webhook@example.com");
@@ -266,7 +263,7 @@ describe("/api/forms/submit", () => {
expect(json.message).toBe(config.successMessage);
expect(fetchMock).toHaveBeenCalledTimes(1);
const [url, options] = fetchMock.mock.calls[0] as [string, RequestInit];
const [url, options] = fetchMock.mock.calls[0] as unknown as [string, RequestInit];
expect(url).toBe(destinationUrl);
expect(options.method).toBe("POST");
});
@@ -319,8 +316,7 @@ describe("/api/forms/submit", () => {
};
const fetchMock = vi.fn(async () => new Response("remote error", { status: 503 }));
// @ts-expect-error - 글로벌 fetch 재정의
global.fetch = fetchMock;
(globalThis as any).fetch = fetchMock;
const formData = new FormData();
formData.append("email_address", "fail-remote@example.com");
@@ -361,8 +357,7 @@ describe("/api/forms/submit", () => {
const fetchMock = vi.fn(async () => {
throw new Error("network error");
});
// @ts-expect-error - 글로벌 fetch 재정의
global.fetch = fetchMock;
(globalThis as any).fetch = fetchMock;
const formData = new FormData();
formData.append("email_address", "exception@example.com");