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 = '1

2

345' expect(convertHtmlToTree(input)).to.eql([ '1 ', [ '

', ['2'], '

' ], [ '', [ '3', [''], '4' ], '' ], '5' ]) }) it('converts semi-broken html', () => { const input = '1
2

42' expect(convertHtmlToTree(input)).to.eql([ '1 ', ['
'], ' 2 ', [ '

', [' 42'] ] ]) }) it('realistic case 1', () => { const input = '

@benis @hj nice

' expect(convertHtmlToTree(input)).to.eql([ [ '

', [ [ '', [ [ '', [ '@', [ '', [ 'benis' ], '' ] ], '' ] ], '' ], ' ', [ '', [ [ '', [ '@', [ '', [ 'hj' ], '' ] ], '' ] ], '' ], ' nice' ], '

' ] ]) }) it('realistic case 2', () => { const inputOutput = 'Country improv: give me a city
Audience: Memphis
Improv troupe: come on, a better one
Audience: el paso' expect(convertHtmlToTree(inputOutput)).to.eql([ 'Country improv: give me a city', [ '
' ], 'Audience: Memphis', [ '
' ], 'Improv troupe: come on, a better one', [ '
' ], 'Audience: el paso' ]) }) }) })