Skip to content

Commit 9bda99c

Browse files
committed
test: add uuid limits test
Release-As: 1.0.0
1 parent 0ecea89 commit 9bda99c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/index.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fc from "fast-check";
2+
import { MAX as MAX_UUID, NIL as NIL_UUID } from "uuid";
23
import { describe, expect, test } from "vitest";
34

45
import { fromIfcGuid, fromIfcGuidArray, toIfcGuid, toIfcGuidArray } from "./index.js";
@@ -40,6 +41,16 @@ describe("ifc guid", () => {
4041
expect(fromIfcGuid(ifc)).toEqual(uuid);
4142
});
4243

44+
test("uuid limits", () => {
45+
const nil = "0000000000000000000000";
46+
expect(toIfcGuid(NIL_UUID)).toEqual(nil);
47+
expect(fromIfcGuid(nil)).toEqual(NIL_UUID);
48+
49+
const max = "3$$$$$$$$$$$$$$$$$$$$$";
50+
expect(toIfcGuid(MAX_UUID)).toEqual(max);
51+
expect(fromIfcGuid(max)).toEqual(MAX_UUID);
52+
});
53+
4354
test("invalid length", () => {
4455
const tooLong = "01bhO9fsz_RxNh9a_y9jls_";
4556
expect(() => fromIfcGuid(tooLong)).toThrowError("Invalid IFC-GUID length (23)");

0 commit comments

Comments
 (0)