import { tokenize } from './tokenize' describe('tokenize', () => { it('still tokenize even when a closing tag is missing', () => { const rawString = '분기' const result = tokenize(rawString) expect(result).toEqual([ { type: 'element', tagName: 'color', attributes: { color: '#FFC741FF' }, children: [ { type: 'text', text: '분기' } ] } ]) }) it('tokenize', () => { const rawString = '기본 공격 또는 분기 공격이 적에게 연소 게이지를 4.0pt 누적한다. 발동 간격: 6.0초. 기본 공격과 분기 공격이 가하는 화염 원소 대미지가 30.0% 증가한다.' const result = tokenize(rawString) expect(result).toEqual([ { type: 'text', text: '기본 공격 또는 분기 공격이 적에게 연소 게이지를 ' }, { type: 'element', tagName: 'color', attributes: { color: '#FEDF4CFF' }, children: [ { type: 'element', tagName: 'color', attributes: { color: '#23B2E3FF' }, children: [ { type: 'text', text: '4.0' } ] }, { type: 'text', text: 'pt 누적한다.' } ] }, { type: 'text', text: ' 발동 간격: ' }, { type: 'element', tagName: 'color', attributes: { color: '#23B2E3FF' }, children: [{ type: 'text', text: '6.0' }] }, { type: 'text', text: '초. 기본 공격과 분기 공격이 가하는 화염 원소 대미지가 ' }, { type: 'element', tagName: 'color', attributes: { color: '#23B2E3FF' }, children: [{ type: 'text', text: '30.0%' }] }, { type: 'text', text: ' 증가한다.' } ]) }) })