2019-10-12 21:05:19 +02:00
|
|
|
import { expect } from 'chai';
|
2019-11-18 22:38:51 +01:00
|
|
|
import 'mocha';
|
2020-02-08 23:26:57 +01:00
|
|
|
import { uuid } from './uuid';
|
2019-10-12 21:05:19 +02:00
|
|
|
|
2020-04-10 05:12:14 +02:00
|
|
|
describe('UUID Service', function () {
|
2019-10-12 21:05:19 +02:00
|
|
|
this.timeout(1000);
|
|
|
|
|
|
|
|
it('provides universal unique identifiers', () => {
|
|
|
|
const uuid1 = uuid();
|
|
|
|
expect(uuid1).to.match(
|
|
|
|
/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,
|
|
|
|
'generated uuid does not match the UUID format'
|
|
|
|
);
|
|
|
|
const uuid2 = uuid();
|
|
|
|
const uuid3 = uuid();
|
|
|
|
expect(uuid2).to.not.equal(uuid3, 'generated uuids are not unique');
|
|
|
|
});
|
|
|
|
});
|