Skip to content

Commit

Permalink
feat(answer-mock): 테스트 종료마다 답변 mock 데이터를 초기화한다 (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
leegwae committed Sep 14, 2023
1 parent 59f56ff commit b160f8f
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/answer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ export const createMockAnswer = (): Answer => ({
export const createMockAnswerList = (size: number): Answer[] =>
[...Array(size).keys()].map(createMockAnswer);

export const mockAnswerList: Answer[] = createMockAnswerList(30 * 3);
export let mockAnswerList: Answer[] = createMockAnswerList(30 * 3);
export const initMockAnswerList = (): void => {
mockAnswerList = createMockAnswerList(30 * 3);
};
2 changes: 2 additions & 0 deletions src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import fetch from 'cross-fetch';

import { server } from '@/mocks/server';

import { initMockAnswerList } from './mocks/data/answer';
import { initMockUser } from './mocks/data/auth';
import { initMockMyPanelList } from './mocks/data/panel';
import { initMockQuestionList } from './mocks/data/question';
Expand Down Expand Up @@ -35,6 +36,7 @@ afterEach(() => {
initMockUser();
initMockMyPanelList();
initMockQuestionList();
initMockAnswerList();
});

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

0 comments on commit b160f8f

Please sign in to comment.