-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: utils 함수 테스트 케이스의 이름을 명확하게 작성
- Loading branch information
Showing
6 changed files
with
55 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import { describe, expect, it } from '@jest/globals'; | ||
import { convertPascalCase } from '../convertPascalCase'; | ||
|
||
describe('convertPascalCase', () => { | ||
it('lower case', () => { | ||
describe('utils/convertPascalCase', () => { | ||
it('lower case 텍스트를 pascal case 로 변환시킨다.', () => { | ||
expect(convertPascalCase('example text')).toBe('Example Text'); | ||
}); | ||
|
||
it('upper case', () => { | ||
it('upper case 텍스트를 pascal case 로 변환시킨다.', () => { | ||
expect(convertPascalCase('EXAMPLE TEXT')).toBe('Example Text'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
import { describe, expect, it } from '@jest/globals'; | ||
import { formatDate } from '../formatDate'; | ||
|
||
describe('formatDate', () => { | ||
it('date type', () => { | ||
describe('utils/formatDate', () => { | ||
it('Date 타입을 특정 format 의 날짜로 변환시킨다.', () => { | ||
const date = new Date('1995-10-05'); | ||
|
||
expect(formatDate(date)).toBe('1995년 10월 5일'); | ||
expect(formatDate(date, 'yyyy년 M월 d일')).toBe('1995년 10월 5일'); | ||
}); | ||
|
||
it('timestamp type', () => { | ||
it('timestamp 를 특정 format 의 날짜로 변환시킨다.', () => { | ||
const date = new Date('1995-10-05').getTime(); | ||
|
||
expect(formatDate(date)).toBe('1995년 10월 5일'); | ||
expect(formatDate(date, 'yyyy년 M월 d일')).toBe('1995년 10월 5일'); | ||
}); | ||
|
||
it('ISO type', () => { | ||
it('ISO 형식을 특정 format 의 날짜로 변환시킨다.', () => { | ||
const iso = new Date('1995-08-25').toISOString(); | ||
|
||
expect(formatDate(iso)).toBe('1995년 8월 25일'); | ||
expect(formatDate(iso, 'yyyy년 M월 d일')).toBe('1995년 8월 25일'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,52 @@ | ||
import { describe, expect, it } from '@jest/globals'; | ||
import mockItems from '@/mocks/notionPageItems'; | ||
import { parseDatabaseItems } from '../parseDatabaseItems'; | ||
|
||
describe('parseDatabaseItems', () => { | ||
it('포스팅 수', () => { | ||
describe('utils/parseDatabaseItems', () => { | ||
it('아이템 수를 받은 만큼 반환한다.', () => { | ||
const items = parseDatabaseItems(mockItems); | ||
|
||
expect(items.length).toBe(10); | ||
}); | ||
|
||
it('포스팅 아이템', () => { | ||
it(`반환된 리스트의 아이템에 'koId' 값이 존재한다.`, () => { | ||
const items = parseDatabaseItems(mockItems); | ||
const item = items[0]; | ||
|
||
expect(item.hasOwnProperty('koId')).toBe(true); | ||
}); | ||
|
||
it(`반환된 리스트의 아이템에 'id'(포스트 아이디) 값이 존재한다.`, () => { | ||
const items = parseDatabaseItems(mockItems); | ||
const item = items[0]; | ||
|
||
expect(item.hasOwnProperty('id')).toBe(true); | ||
}); | ||
|
||
it(`반환된 리스트의 아이템에 'title'(포스트 제목) 값이 존재한다.`, () => { | ||
const items = parseDatabaseItems(mockItems); | ||
const item = items[0]; | ||
|
||
expect(item.title).toBe('포스트 제목_1'); | ||
}); | ||
|
||
it(`반환된 리스트의 아이템에 'tags'(포스트 태그 리스트) 값이 존재한다.`, () => { | ||
const items = parseDatabaseItems(mockItems); | ||
const item = items[0]; | ||
|
||
expect(item.hasOwnProperty('tags')).toBe(true); | ||
}); | ||
|
||
it(`반환된 리스트의 아이템에 'createdAt'(포스트 작성일) 값이 존재한다.`, () => { | ||
const items = parseDatabaseItems(mockItems); | ||
const item = items[0]; | ||
|
||
expect(item.createdAt).toBe('2024-04-29T11:33:00.000Z'); | ||
}); | ||
|
||
it(`반환된 리스트의 아이템에 'isCompleted'(작성 완료 여부) 값이 존재한다.`, () => { | ||
const items = parseDatabaseItems(mockItems); | ||
const item = items[0]; | ||
|
||
expect(item.hasOwnProperty('isCompleted')).toBe(true); | ||
}); | ||
}); |