|
|
@@ -9,10 +9,14 @@ import mapsEqual from '/ckeditor5/utils/mapsequal.js';
|
|
|
|
|
|
describe( 'utils', () => {
|
|
|
describe( 'mapsEqual', () => {
|
|
|
- it( 'should return true if maps have exactly same entries (order of adding does not matter)', () => {
|
|
|
- let mapA = new Map();
|
|
|
- let mapB = new Map();
|
|
|
+ let mapA, mapB;
|
|
|
+
|
|
|
+ beforeEach( () => {
|
|
|
+ mapA = new Map();
|
|
|
+ mapB = new Map();
|
|
|
+ } );
|
|
|
|
|
|
+ it( 'should return true if maps have exactly same entries (order of adding does not matter)', () => {
|
|
|
mapA.set( 'foo', 'bar' );
|
|
|
mapA.set( 'abc', 'xyz' );
|
|
|
|
|
|
@@ -21,5 +25,24 @@ describe( 'utils', () => {
|
|
|
|
|
|
expect( mapsEqual( mapA, mapB ) ).to.be.true;
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'should return false if maps size is not the same', () => {
|
|
|
+ mapA.set( 'foo', 'bar' );
|
|
|
+ mapA.set( 'abc', 'xyz' );
|
|
|
+
|
|
|
+ mapB.set( 'abc', 'xyz' );
|
|
|
+
|
|
|
+ expect( mapsEqual( mapA, mapB ) ).to.be.false;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should return false if maps entries are not exactly the same', () => {
|
|
|
+ mapA.set( 'foo', 'bar' );
|
|
|
+ mapA.set( 'abc', 'xyz' );
|
|
|
+
|
|
|
+ mapB.set( 'foo', 'bar' );
|
|
|
+ mapB.set( 'xyz', 'abc' );
|
|
|
+
|
|
|
+ expect( mapsEqual( mapA, mapB ) ).to.be.false;
|
|
|
+ } );
|
|
|
} );
|
|
|
} );
|