From 825a4b787ad03ccdb620ec1a2a0fa2dd97d90354 Mon Sep 17 00:00:00 2001 From: iseulde Date: Tue, 29 Jan 2019 14:55:22 +0100 Subject: [PATCH] Add more tests --- .../rich-text/src/test/indent-list-items.js | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/packages/rich-text/src/test/indent-list-items.js b/packages/rich-text/src/test/indent-list-items.js index 04f29ee51c8d18..e7f631e5fa8f94 100644 --- a/packages/rich-text/src/test/indent-list-items.js +++ b/packages/rich-text/src/test/indent-list-items.js @@ -140,16 +140,38 @@ describe( 'indentListItems', () => { start: 6, end: 6, }; - const expected = { + + const result1 = indentListItems( deepFreeze( record ), ul ); + + expect( result1 ).not.toBe( record ); + expect( getSparseArrayLength( result1.formats ) ).toBe( 3 ); + expect( result1 ).toEqual( { formats: [ , [ ul ], , [ ul, ul ], , [ ul ], , ], text, start: 6, end: 6, - }; - const result = indentListItems( deepFreeze( record ), ul ); + } ); - expect( result ).toEqual( expected ); - expect( result ).not.toBe( record ); - expect( getSparseArrayLength( result.formats ) ).toBe( 3 ); + const result2 = indentListItems( deepFreeze( result1 ), ul ); + + expect( result2 ).not.toBe( result1 ); + expect( getSparseArrayLength( result2.formats ) ).toBe( 3 ); + expect( result2 ).toEqual( { + formats: [ , [ ul ], , [ ul, ul ], , [ ul, ul ], , ], + text, + start: 6, + end: 6, + } ); + + const result3 = indentListItems( deepFreeze( result2 ), ul ); + + expect( result3 ).not.toBe( result2 ); + expect( getSparseArrayLength( result3.formats ) ).toBe( 3 ); + expect( result3 ).toEqual( { + formats: [ , [ ul ], , [ ul, ul ], , [ ul, ul, ul ], , ], + text, + start: 6, + end: 6, + } ); } ); } );