UNPKG

574 BJavaScriptView Raw
1import getUID from './get-uid';
2
3describe('getUid', () => {
4 it('should throw an exception if the "name" argument isn\'t passed', () => {
5 () => getUID().should.throw(Error);
6 });
7
8 it('should return a unique id every time', () => {
9 const id1 = getUID('test');
10 const id2 = getUID('test');
11 const id3 = getUID('test');
12
13 id1.should.not.be.equal(id2);
14 id2.should.not.be.equal(id3);
15 });
16
17 it('should return an id having a passed prefix', () => {
18 getUID('test').should.have.string('test');
19 getUID('tset').should.have.string('tset');
20 });
21});