-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 테스트 관심사에 따른 describe 세분화 (#80)
* test: describe 세분화(chosungIncludes) * test: describe 세분화(hangulIncludes) * test: describe 세분화(utils)
- Loading branch information
1 parent
dbeeeab
commit 18085b6
Showing
3 changed files
with
141 additions
and
104 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,31 +1,35 @@ | ||
import { chosungIncludes } from './chosungIncludes'; | ||
|
||
describe('chosungIncludes', () => { | ||
it('should return true when "ㅍㄹㅌ" is entered for searching "프론트엔드"', () => { | ||
expect(chosungIncludes('프론트엔드', 'ㅍㄹㅌ')).toBe(true); | ||
}); | ||
describe('초성이 포함되어있다고 판단되는 경우', () => { | ||
it('should return true when "ㅍㄹㅌ" is entered for searching "프론트엔드"', () => { | ||
expect(chosungIncludes('프론트엔드', 'ㅍㄹㅌ')).toBe(true); | ||
}); | ||
|
||
it('should return true when "ㅍㄹㅌ" is entered for searching "00프론트엔드"', () => { | ||
expect(chosungIncludes('00프론트엔드', 'ㅍㄹㅌ')).toBe(true); | ||
}); | ||
it('should return true when "ㅍㄹㅌ" is entered for searching "00프론트엔드"', () => { | ||
expect(chosungIncludes('00프론트엔드', 'ㅍㄹㅌ')).toBe(true); | ||
}); | ||
|
||
it('should return false when "ㅍㅌ" is entered for searching "프론트엔드"', () => { | ||
expect(chosungIncludes('프론트엔드', 'ㅍㅌ')).toBe(false); | ||
}); | ||
it('should return true when "ㅍㄹㅌㅇㄷㄱㅂㅈ" is entered for searching "프론트엔드 개발자"', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', 'ㅍㄹㅌㅇㄷㄱㅂㅈ')).toBe(true); | ||
}); | ||
|
||
it('should return true when "ㅍㄹㅌㅇㄷㄱㅂㅈ" is entered for searching "프론트엔드 개발자"', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', 'ㅍㄹㅌㅇㄷㄱㅂㅈ')).toBe(true); | ||
it('should return true when "ㅍㄹㅌㅇㄷ ㄱㅂㅈ" is entered for searching "프론트엔드 개발자"', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', 'ㅍㄹㅌㅇㄷ ㄱㅂㅈ')).toBe(true); | ||
}); | ||
}); | ||
|
||
it('should return true when "ㅍㄹㅌㅇㄷ ㄱㅂㅈ" is entered for searching "프론트엔드 개발자"', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', 'ㅍㄹㅌㅇㄷ ㄱㅂㅈ')).toBe(true); | ||
}); | ||
describe('초성이 포함되어있다고 판단되지 않는 경우', () => { | ||
it('should return false when "ㅍㅌ" is entered for searching "프론트엔드"', () => { | ||
expect(chosungIncludes('프론트엔드', 'ㅍㅌ')).toBe(false); | ||
}); | ||
|
||
it('should return true when "ㅍㄹㅌㅇㄷ ㄱㅂㅈ" is entered for searching " "', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', ' ')).toBe(false); | ||
}); | ||
it('should return false when "ㅍㄹㅌㅇㄷ ㄱㅂㅈ" is entered for searching " "', () => { | ||
expect(chosungIncludes('프론트엔드 개발자', ' ')).toBe(false); | ||
}); | ||
|
||
it('should return false when "푸롴트" is entered for searching "프론트엔드" as it does not only include the initial consonants.', () => { | ||
expect(chosungIncludes('프론트엔드', '푸롴트')).toBe(false); | ||
it('should return false when "푸롴트" is entered for searching "프론트엔드" as it does not only include the initial consonants.', () => { | ||
expect(chosungIncludes('프론트엔드', '푸롴트')).toBe(false); | ||
}); | ||
}); | ||
}); |
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,20 +1,30 @@ | ||
import { hangulIncludes } from './hangulIncludes'; | ||
|
||
describe('hangulIncludes', () => { | ||
it('사과', () => { | ||
expect(hangulIncludes('사과', '')).toBe(true); | ||
expect(hangulIncludes('사과', 'ㅅ')).toBe(true); | ||
expect(hangulIncludes('사과', '삭')).toBe(true); | ||
expect(hangulIncludes('사과', '삽')).toBe(false); | ||
expect(hangulIncludes('사과', '사과')).toBe(true); | ||
describe('한글이 포함되어있다고 판단되는 경우', () => { | ||
it('사과', () => { | ||
expect(hangulIncludes('사과', '')).toBe(true); | ||
expect(hangulIncludes('사과', 'ㅅ')).toBe(true); | ||
expect(hangulIncludes('사과', '삭')).toBe(true); | ||
expect(hangulIncludes('사과', '사과')).toBe(true); | ||
}); | ||
|
||
it('프론트엔드', () => { | ||
expect(hangulIncludes('프론트엔드', '')).toBe(true); | ||
expect(hangulIncludes('프론트엔드', '플')).toBe(true); | ||
expect(hangulIncludes('프론트엔드', '틍')).toBe(true); | ||
expect(hangulIncludes('프론트엔드', '플')).toBe(true); | ||
expect(hangulIncludes('프론트엔드', '프로')).toBe(true); | ||
}); | ||
}); | ||
|
||
it('프론트엔드', () => { | ||
expect(hangulIncludes('프론트엔드', '')).toBe(true); | ||
expect(hangulIncludes('프론트엔드', '플')).toBe(true); | ||
expect(hangulIncludes('프론트엔드', '틍')).toBe(true); | ||
expect(hangulIncludes('프론트엔드', '픏')).toBe(false); | ||
expect(hangulIncludes('프론트엔드', '플')).toBe(true); | ||
expect(hangulIncludes('프론트엔드', '프로')).toBe(true); | ||
describe('한글이 포함되어있다고 판단되지 않는 경우', () => { | ||
it('사과', () => { | ||
expect(hangulIncludes('사과', '삽')).toBe(false); | ||
}); | ||
|
||
it('프론트엔드', () => { | ||
expect(hangulIncludes('프론트엔드', '픏')).toBe(false); | ||
}); | ||
}); | ||
}); |
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