Skip to content

Commit

Permalink
fix: 테스트 코드 모킹데이터 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
summersummerwhy committed Nov 13, 2024
1 parent 0b25339 commit f30286c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion backend/src/node/node.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { CoordinateResponseDto } from './dtos/coordinateResponse.dto';
import { FindNodeResponseDto } from './dtos/findNodeResponse.dto';
import { FindNodesResponseDto } from './dtos/findNodesResponse.dto.';


export enum NodeResponseMessage {
NODE_RETURNED = '노드와 페이지를 가져왔습니다.',
NODE_ALL_RETURNED = '모든 노드를 가져왔습니다.',
Expand Down
21 changes: 12 additions & 9 deletions backend/src/page/page.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ describe('PageService', () => {
x: 1,
y: 1,
};

const newDate = new Date();
// 페이지 엔티티
const newPage: Page = {
id: 1,
title: 'new page',
content: {} as JSON,
createdAt: new Date(),
updatedAt: new Date(),
createdAt: newDate,
updatedAt: newDate,
version: 1,
node: null,
};
Expand Down Expand Up @@ -122,22 +122,24 @@ describe('PageService', () => {
title: 'Updated Title',
content: {} as JSON,
};
const originDate = new Date();
const originPage: Page = {
id: 1,
title: 'origin title',
content: {} as JSON,
node: null,
createdAt: new Date(),
updatedAt: new Date(),
createdAt: originDate,
updatedAt: originDate,
version: 1,
};
const newDate = new Date();
const newPage: Page = {
id: 1,
title: 'Updated Title',
content: {} as JSON,
node: null,
createdAt: new Date(),
updatedAt: new Date(),
createdAt: newDate,
updatedAt: newDate,
version: 1,
};

Expand Down Expand Up @@ -166,13 +168,14 @@ describe('PageService', () => {

describe('findPageById', () => {
it('id에 해당하는 페이지를 찾아 성공적으로 반환한다.', async () => {
const newDate = new Date();
const expectedPage: Page = {
id: 1,
title: 'title',
content: {} as JSON,
node: null,
createdAt: new Date(),
updatedAt: new Date(),
createdAt: newDate,
updatedAt: newDate,
version: 1,
};
jest.spyOn(pageRepository, 'findOneBy').mockResolvedValue(expectedPage);
Expand Down

0 comments on commit f30286c

Please sign in to comment.