uid.js 690 B

123456789101112131415161718192021222324
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import uid from '../src/uid';
  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 ).to.match( /^[a-z][a-z0-9]{32}$/ );
  16. expect( id2 ).to.match( /^[a-z][a-z0-9]{32}$/ );
  17. expect( id3 ).to.match( /^[a-z][a-z0-9]{32}$/ );
  18. } );
  19. } );
  20. } );