Skip to content

Commit

Permalink
feat(question-mock): 테스트 종료마다 질문 mock 데이터를 초기화한다 (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
leegwae committed Sep 17, 2023
1 parent 7486f2f commit 3c9334f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mocks/data/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ export const createMockQuestion = (): Question => ({
export const createMockQuestionList = (size: number): Question[] =>
[...Array(size).keys()].map(createMockQuestion);

export const mockQuestionList: Question[] = createMockQuestionList(30 * 3);
export let mockQuestionList: Question[] = createMockQuestionList(30 * 3);
export const initMockQuestionList = (): void => {
mockQuestionList = createMockQuestionList(30 * 3);
};
2 changes: 2 additions & 0 deletions src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { server } from '@/mocks/server';

import { initMockUser } from './mocks/data/auth';
import { initMockMyPanelList } from './mocks/data/panel';
import { initMockQuestionList } from './mocks/data/question';

globalThis.fetch = fetch;

Expand Down Expand Up @@ -33,6 +34,7 @@ afterAll(() => {
afterEach(() => {
initMockUser();
initMockMyPanelList();
initMockQuestionList();
});

/* ===================== [ IntersectionObserver 모킹 ] ===================== */
Expand Down

0 comments on commit 3c9334f

Please sign in to comment.