Skip to content

Commit f0d5395

Browse files
committed
fix: handleSloganFormSubmit 테스트 no-explicit-any 린트 오류 수정
1 parent 1941c7a commit f0d5395

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/entities/slogan/lib/__tests__/handleSloganFormSubmit.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { describe, it, expect, vi, beforeEach } from "vitest";
2+
import type { AxiosResponse } from "axios";
23
import { handleSloganFormSubmit } from "../handleSloganFormSubmit";
34

45
vi.mock("@/entities/slogan/api/postSlogan", () => ({ postSlogan: vi.fn() }));
@@ -27,16 +28,16 @@ beforeEach(() => {
2728

2829
describe("handleSloganFormSubmit - 제출 성공", () => {
2930
it("status 200이면 toast.success를 호출하고 응답을 반환한다", async () => {
30-
const res = { status: 200, data: {} };
31-
mockPostSlogan.mockResolvedValue(res as any);
31+
const res = { status: 200, data: {} } as AxiosResponse<unknown>;
32+
mockPostSlogan.mockResolvedValue(res);
3233
const result = await handleSloganFormSubmit(VALID_VALUES);
3334
expect(mockSuccess).toHaveBeenCalledWith("슬로건이 제출되었습니다.");
3435
expect(result).toBe(res);
3536
});
3637

3738
it("status 201이면 toast.success를 호출하고 응답을 반환한다", async () => {
38-
const res = { status: 201, data: {} };
39-
mockPostSlogan.mockResolvedValue(res as any);
39+
const res = { status: 201, data: {} } as AxiosResponse<unknown>;
40+
mockPostSlogan.mockResolvedValue(res);
4041
const result = await handleSloganFormSubmit(VALID_VALUES);
4142
expect(mockSuccess).toHaveBeenCalledWith("슬로건이 제출되었습니다.");
4243
expect(result).toBe(res);
@@ -51,13 +52,13 @@ describe("handleSloganFormSubmit - 제출 실패", () => {
5152
});
5253

5354
it("비정상 상태코드(400)이면 toast.error를 호출한다", async () => {
54-
mockPostSlogan.mockResolvedValue({ status: 400, data: {} } as any);
55+
mockPostSlogan.mockResolvedValue({ status: 400, data: {} } as AxiosResponse<unknown>);
5556
await handleSloganFormSubmit(VALID_VALUES);
5657
expect(mockError).toHaveBeenCalledWith("슬로건 제출에 실패했습니다.");
5758
});
5859

5960
it("비정상 상태코드(500)이면 toast.error를 호출한다", async () => {
60-
mockPostSlogan.mockResolvedValue({ status: 500, data: {} } as any);
61+
mockPostSlogan.mockResolvedValue({ status: 500, data: {} } as AxiosResponse<unknown>);
6162
await handleSloganFormSubmit(VALID_VALUES);
6263
expect(mockError).toHaveBeenCalledWith("슬로건 제출에 실패했습니다.");
6364
});

0 commit comments

Comments
 (0)