CI빌드 오류 수정
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user