From 35e5e90459bf625060296c0c3b9ea86fe1275580 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laroche Date: Wed, 14 May 2025 12:04:24 -0400 Subject: [PATCH 1/2] Bump the maximum variant to 19 for the cid helper function --- lib/sdk.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sdk.ts b/lib/sdk.ts index dede87d..78755ea 100644 --- a/lib/sdk.ts +++ b/lib/sdk.ts @@ -128,7 +128,7 @@ class OptableSDK { throw new Error("Invalid ppid"); } - if (typeof variant !== "number" || isNaN(variant) || variant < 0 || variant > 9) { + if (typeof variant !== "number" || isNaN(variant) || variant < 0 || variant > 19) { throw new Error("Invalid variant"); } From f32cc73254e7a79ed73a62c9a07ab2a1087afdd3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laroche Date: Wed, 14 May 2025 12:08:17 -0400 Subject: [PATCH 2/2] Update tests for cid helper now accepting up to c19 --- lib/sdk.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sdk.test.ts b/lib/sdk.test.ts index bf45eb8..4a6d638 100644 --- a/lib/sdk.test.ts +++ b/lib/sdk.test.ts @@ -40,12 +40,12 @@ describe("cid", () => { test("accepts a custom variant", () => { expect(OptableSDK.cid("abc", 0)).toEqual("c:abc"); - for (let i = 1; i < 10; i++) { + for (let i = 1; i < 20; i++) { expect(OptableSDK.cid("abc", i)).toEqual(`c${i}:abc`); } expect(() => OptableSDK.cid("abc", -1)).toThrow(); - expect(() => OptableSDK.cid("abc", 10)).toThrow(); + expect(() => OptableSDK.cid("abc", 20)).toThrow(); expect(() => OptableSDK.cid("abc", "1" as unknown as number)).toThrow(); });