Skip to content

Commit

Permalink
test : removeLastHangulCharacter 에 대한 테스트 추가 (#118)
Browse files Browse the repository at this point in the history
* test: 이중모음에 대한 테스트 추가

* test: 상표 사용을 피하기 위한 테스트 단어 변경

* docs: @example에 이중모음 예시 추가
  • Loading branch information
beberiche committed Jun 18, 2024
1 parent bf863d9 commit 7d3f5ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/removeLastHangulCharacter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ describe('removeLastHangulCharacter', () => {
expect(removeLastHangulCharacter('일요일')).toBe('일요이');
expect(removeLastHangulCharacter('깎')).toBe('까');
});
it('마지막 문자가 초성과 중성의 조합으로 끝나며, 중성 입력 시 국제 표준 한글 레이아웃 기준 단일키로 처리되지 않는 이중모음 (ㅗ/ㅜ/ㅡ 계 이중모음) 인 경우 초성과 중성의 시작 모음만 남긴다.', () => {
expect(removeLastHangulCharacter('전화')).toBe('전호');
expect(removeLastHangulCharacter('예의')).toBe('예으');
expect(removeLastHangulCharacter("신세계")).toBe('신세ㄱ'); // 'ㅖ'의 경우 단일키 처리가 가능한 이중모음이므로 모음이 남지 않는다.
});
it('빈 문자열일 경우 빈 문자열을 반환한다.', () => {
expect(removeLastHangulCharacter('')).toBe('');
});
Expand Down
2 changes: 2 additions & 0 deletions src/removeLastHangulCharacter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { excludeLastElement } from './_internal';
* removeLastHangulCharacter('안녕하세요 값') // 안녕하세요 갑
* removeLastHangulCharacter('프론트엔드') // 프론트엔ㄷ
* removeLastHangulCharacter('일요일') // 일요이
* removeLastHangulCharacter('전화') // 전호
* removeLastHangulCharacter('신세계') // 신세ㄱ
*/
export function removeLastHangulCharacter(words: string) {
const disassembledGroups = disassembleHangulToGroups(words);
Expand Down

0 comments on commit 7d3f5ab

Please sign in to comment.