diff --git a/client/src/templates/Challenges/components/pinyin-to-hanzi-input.test.tsx b/client/src/templates/Challenges/components/pinyin-to-hanzi-input.test.tsx index da71228028a..63a8a6849e7 100644 --- a/client/src/templates/Challenges/components/pinyin-to-hanzi-input.test.tsx +++ b/client/src/templates/Challenges/components/pinyin-to-hanzi-input.test.tsx @@ -100,6 +100,17 @@ describe('convertToHanzi', () => { '你好' ); }); + + test('should convert "v" to "ü" and support tone marks', () => { + // Correct tone gets converted to hanzi + expect(convertToHanzi('nv3', { hanzi: '女', pinyin: 'nǚ' })).toBe('女'); + + // Incorrect tones stay as pinyin + expect(convertToHanzi('nv1', { hanzi: '女', pinyin: 'nǚ' })).toBe('nǖ'); + expect(convertToHanzi('nv2', { hanzi: '女', pinyin: 'nǚ' })).toBe('nǘ'); + expect(convertToHanzi('nv4', { hanzi: '女', pinyin: 'nǚ' })).toBe('nǜ'); + expect(convertToHanzi('nv5', { hanzi: '女', pinyin: 'nǚ' })).toBe('nü'); + }); }); describe('PinyinToHanziInput component', () => {