import { cleanupHtmlOutput } from './cleanup-html-output' // Test cases structure: // removeWhat (string), removeFrom (string), input (string), expected (string) const testCases = [ [ '', ' > ', '

italic text

', '

italic text

', ], [ '', ' > ', '

Heading 1 with 🧙🏼‍♂️

', '

Heading 1 with 🧙🏼‍♂️

', ], ['', '

> ', '

test

', '

test

'], ['', '

> ', '

test

', '

test

'], [ '', '
 > ',
    '
test
', '
test
', ], [ '', ' > ', 'test', 'test', ], [ 'multiple tags', '

> ', '

italic text test

', '

italic text test

', ], ] describe('cleanupHtmlOutput', () => { it.each(testCases)( 'removes %s from %s combinations', (what, from, input, expected) => { const result = cleanupHtmlOutput(input) expect(result).toBe(expected) } ) it('replaces with tag', () => { const result = cleanupHtmlOutput( '

test test test

' ) expect(result).toBe( '

test test test

' ) }) it('hoists nested lists to previous sibling', () => { const result = cleanupHtmlOutput(`
  • first
    • second
`).replace(/\s/g, '') const expected = `
  • first
    • second
`.replace(/\s/g, '') expect(result).toBe(expected) }) })