import { convertHtmlToTree } from 'src/services/html_converter/html_tree_converter.service.js' describe('html_tree_converter', () => { describe('convertHtmlToTree', () => { it('converts html into a tree structure', () => { const input = '1
2
345' expect(convertHtmlToTree(input)).to.eql([ '1 ', [ '', ['2'], '
' ], ' ', [ '', [ '3', [''], '4' ], '' ], '5' ]) }) it('converts html to tree while preserving tag formatting', () => { const input = '12
345' expect(convertHtmlToTree(input)).to.eql([ '1 ', [ '', ['2'], '
' ], [ '', [ '3', [''], '4' ], '' ], '5' ]) }) it('converts semi-broken html', () => { const input = '1 42'
expect(convertHtmlToTree(input)).to.eql([
'1 ',
['
'],
' 2 ',
[
'
', [' 42'] ] ]) }) it('realistic case 1', () => { const input = '
' expect(convertHtmlToTree(input)).to.eql([ [ '', [ [ '', [ [ '', [ '@', [ '', [ 'benis' ], '' ] ], '' ] ], '' ], ' ', [ '', [ [ '', [ '@', [ '', [ 'hj' ], '' ] ], '' ] ], '' ], ' nice' ], '
' ] ]) }) it('realistic case 2', () => { const inputOutput = 'Country improv: give me a city