12 lines
384 B
TypeScript
12 lines
384 B
TypeScript
import { uuidV7 } from './uuid-v7';
|
|
|
|
describe('uuidV7', () => {
|
|
it('creates an RFC 9562 version 7 UUID with time-sortable prefixes', () => {
|
|
const first = uuidV7(1_700_000_000_000);
|
|
const second = uuidV7(1_700_000_000_001);
|
|
|
|
expect(first).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
expect(first < second).toBe(true);
|
|
});
|
|
});
|