@tdb/util
Version:
Shared helpers and utilities.
16 lines (13 loc) • 408 B
text/typescript
import { expect } from 'chai';
import { R } from '../../libs';
import { id } from '.';
describe('id.shortid', () => {
it('creates a new short id', () => {
const result = id.shortid();
expect(result.length).to.be.greaterThan(5);
});
it('ids are unique', () => {
const ids = Array.from({ length: 1000 }).map(() => id.shortid());
expect(ids.length).to.eql(R.uniq(ids).length);
});
});