浏览代码

Improve Collection class test case

Oskar Wrobel 9 年之前
父节点
当前提交
a55833d898
共有 1 个文件被更改,包括 6 次插入4 次删除
  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 );
 			}
 		);