Explorar el Código

Improve Collection class test case

Oskar Wrobel hace 9 años
padre
commit
a55833d898
Se han modificado 1 ficheros con 6 adiciones y 4 borrados
  1. 6 4
      packages/ckeditor5-utils/tests/collection.js

+ 6 - 4
packages/ckeditor5-utils/tests/collection.js

@@ -142,15 +142,17 @@ describe( 'Collection', () => {
 			'should not override item under an existing id in case of a collision ' +
 			'between existing items and one with an automatically generated id',
 			() => {
-				collection.add( getItem( '0' ) );
-				collection.add( getItem( '1' ) );
-				collection.add( getItem( '2' ) );
+				// Add many items to collection
+				// to be sure that next item id will be higher than id already stored in uid cache
+				for ( let i = 0; i <= 100; i++ ) {
+					collection.add( getItem( String( i ) ) );
+				}
 
 				let item = {};
 
 				collection.add( item );
 
-				expect( item.id ).to.be.above( '3' );
+				expect( item.id ).to.be.at.least( 100 );
 			}
 		);