forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

uuid-time.test.ts16 lines, 580 bytesHistoryRawDownload
1import { uuidV7Ms } from "./uuid-time";
2
3describe("uuidV7Ms", () => {
4 it("reads the unix-ms prefix of a v7 id", () => {
5 expect(uuidV7Ms("01a0b1b0-aca9-7025-b739-d3ad153d617b")).toBe(0x01a0b1b0aca9);
6 });
7
8 it("orders ids created later after earlier ones", () => {
9 expect(uuidV7Ms("01a0b1b0-aca9-7025-b739-d3ad153d617b")!).toBeLessThan(uuidV7Ms("01a0b1b1-0000-7000-8000-000000000000")!);
10 });
11
12 it("returns null for a non-v7 id", () => {
13 expect(uuidV7Ms("123e4567-e89b-42d3-a456-426614174000")).toBeNull();
14 expect(uuidV7Ms("not-an-id")).toBeNull();
15 });
16});