8
0

uid.js 793 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import uid from 'ckeditor5/utils/uid.js';
  6. describe( 'utils', () => {
  7. describe( 'uid', () => {
  8. it( 'should return different ids', () => {
  9. let id1 = uid();
  10. let id2 = uid();
  11. let id3 = uid();
  12. expect( id1 ).to.be.a( 'string' );
  13. expect( id2 ).to.be.a( 'string' ).to.not.equal( id1 ).to.not.equal( id3 );
  14. expect( id3 ).to.be.a( 'string' ).to.not.equal( id1 ).to.not.equal( id2 );
  15. expect( id1[ 0 ] ).to.match( /[a-z]/ );
  16. expect( id2[ 0 ] ).to.match( /[a-z]/ );
  17. expect( id3[ 0 ] ).to.match( /[a-z]/ );
  18. expect( id1 ).to.have.length( 33 );
  19. expect( id2 ).to.have.length( 33 );
  20. expect( id3 ).to.have.length( 33 );
  21. } );
  22. } );
  23. } );