id generator test

This commit is contained in:
antelle 2020-03-21 11:26:49 +01:00
parent 72c77305e4
commit a1a02d5098
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
import { expect } from 'chai';
import { IdGenerator } from 'util/generators/id-generator';
describe('IdGenerator', () => {
it('should generate uuid', () => {
expect(IdGenerator.uuid()).to.match(
/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i
);
});
it('should generate s4', () => {
expect(IdGenerator.s4()).to.match(/^[a-f0-9]{4}$/i);
});
});