8
0

uid.js 751 B

1234567891011121314151617181920212223242526
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. import uid from '../src/uid';
  6. describe( 'utils', () => {
  7. describe( 'uid', () => {
  8. it( 'should return different ids', () => {
  9. const id1 = uid();
  10. const id2 = uid();
  11. const 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. const uuidRegex = /^e[a-f0-9]{32}$/;
  16. expect( id1 ).to.match( uuidRegex );
  17. expect( id2 ).to.match( uuidRegex );
  18. expect( id3 ).to.match( uuidRegex );
  19. } );
  20. } );
  21. } );