From 50d0c09e9c07dbc7663dc661112c36053a571a99 Mon Sep 17 00:00:00 2001 From: Szymon Cofalik Date: Thu, 11 May 2017 13:25:07 +0200 Subject: [PATCH] Tests: modified test for MarkerDelta transformation with null ranges. --- tests/model/delta/transform/markerdelta.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/model/delta/transform/markerdelta.js b/tests/model/delta/transform/markerdelta.js index c46d64f37..559e28879 100644 --- a/tests/model/delta/transform/markerdelta.js +++ b/tests/model/delta/transform/markerdelta.js @@ -233,7 +233,7 @@ describe( 'transform', () => { } ); } ); - it( 'transforming MarkerDelta with null ranges should not crash', () => { + it( 'null ranges of MarkerDelta should not be changed during transformation', () => { const markerDelta = getMarkerDelta( 'name', null, null, baseVersion ); // Transform `markerDelta` by any other delta that has a special transformation case with `MarkerDelta`. @@ -241,8 +241,16 @@ describe( 'transform', () => { const wrapRange = new Range( new Position( root, [ 1 ] ), new Position( root, [ 2 ] ) ); const wrapDelta = getWrapDelta( wrapRange, wrapElement, baseVersion ); - expect( () => { - transform( markerDelta, wrapDelta ); - } ).not.to.throw(); + const transformed = transform( markerDelta, wrapDelta ); + + expect( transformed.length ).to.equal( 1 ); + expect( transformed[ 0 ].operations.length ).to.equal( 1 ); + + const transformedOp = transformed[ 0 ].operations[ 0 ]; + + expect( transformedOp ).to.be.instanceof( MarkerOperation ); + expect( transformedOp.oldRange ).to.be.null; + expect( transformedOp.newRange ).to.be.null; + expect( transformedOp.name ).to.equal( 'name' ); } ); } );