import { describe, expect, it } from 'vitest'; import normaliseBlocks from '../normalise-blocks'; describe( 'normaliseBlocks', () => { it( 'should convert double line breaks to paragraphs', () => { expect( normaliseBlocks( 'test

test' ) ).toEqual( '

test

test

' ); } ); it( 'should not convert single line break to paragraphs', () => { expect( normaliseBlocks( 'test
test' ) ).toEqual( '

test
test

' ); } ); it( 'should not add extra line at the start', () => { expect( normaliseBlocks( 'test


test' ) ).toEqual( '

test

test

' ); expect( normaliseBlocks( '
test

test' ) ).toEqual( '

test

test

' ); } ); it( 'should preserve non-inline content', () => { const HTML = '

test

test
test
'; expect( normaliseBlocks( HTML ) ).toEqual( HTML ); } ); it( 'should remove empty paragraphs', () => { expect( normaliseBlocks( '

 

' ) ).toEqual( '' ); } ); it( 'should wrap lose inline elements', () => { expect( normaliseBlocks( 'test' ) ).toEqual( '

test

' ); } ); it( 'should not break between inline siblings', () => { expect( normaliseBlocks( 'test is a test of test using a test.' ) ).toEqual( '

test is a test of test using a test.

' ); } ); it( 'should not append empty text nodes', () => { expect( normaliseBlocks( '

test

\n' ) ).toEqual( '

test

' ); } ); } );