From 2d9300f7c5b4e31a3685b6eb034c59abca6d9dd1 Mon Sep 17 00:00:00 2001 From: "gitauto-ai[bot]" <161652217+gitauto-ai[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:15:01 +0000 Subject: [PATCH 1/5] Initial empty commit to create PR From dc57cf1556ebd2337b2901d40c482e134d8557c5 Mon Sep 17 00:00:00 2001 From: "gitauto-ai[bot]" <161652217+gitauto-ai[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:15:53 +0000 Subject: [PATCH 2/5] Update utils/transform.test.ts [skip ci] --- utils/transform.test.ts | 129 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 utils/transform.test.ts diff --git a/utils/transform.test.ts b/utils/transform.test.ts new file mode 100644 index 0000000..e09b9ae --- /dev/null +++ b/utils/transform.test.ts @@ -0,0 +1,129 @@ +import { stringify } from "./transform"; + +describe("stringify", () => { + describe("primitive types", () => { + it("should stringify strings", () => { + expect(stringify("hello")).toBe('"hello"'); + expect(stringify("")).toBe('""'); + expect(stringify("with spaces")).toBe('"with spaces"'); + }); + + it("should stringify numbers", () => { + expect(stringify(42)).toBe("42"); + expect(stringify(0)).toBe("0"); + expect(stringify(-1)).toBe("-1"); + expect(stringify(3.14)).toBe("3.14"); + }); + + it("should stringify booleans", () => { + expect(stringify(true)).toBe("true"); + expect(stringify(false)).toBe("false"); + }); + + it("should stringify null", () => { + expect(stringify(null)).toBe("null"); + }); + + it("should stringify undefined", () => { + expect(stringify(undefined)).toBe(undefined); + }); + }); + + describe("bigint handling", () => { + it("should convert bigint to string with 'n' suffix", () => { + expect(stringify(BigInt(123))).toBe('"123n"'); + expect(stringify(BigInt(0))).toBe('"0n"'); + expect(stringify(BigInt(-456))).toBe('"-456n"'); + }); + + it("should handle large bigint values", () => { + const largeBigInt = BigInt("9007199254740991"); + expect(stringify(largeBigInt)).toBe('"9007199254740991n"'); + }); + + it("should handle bigint in objects", () => { + const obj = { id: BigInt(123), name: "test" }; + expect(stringify(obj)).toBe('{"id":"123n","name":"test"}'); + }); + + it("should handle bigint in arrays", () => { + const arr = [BigInt(1), BigInt(2), BigInt(3)]; + expect(stringify(arr)).toBe('["1n","2n","3n"]'); + }); + + it("should handle multiple bigints in nested structures", () => { + const obj = { + user: { + id: BigInt(123), + balance: BigInt(1000), + }, + items: [BigInt(1), BigInt(2)], + }; + expect(stringify(obj)).toBe( + '{"user":{"id":"123n","balance":"1000n"},"items":["1n","2n"]}' + ); + }); + }); + + describe("objects", () => { + it("should stringify simple objects", () => { + expect(stringify({ a: 1, b: 2 })).toBe('{"a":1,"b":2}'); + }); + + it("should stringify empty objects", () => { + expect(stringify({})).toBe("{}"); + }); + + it("should stringify nested objects", () => { + const obj = { a: { b: { c: 1 } } }; + expect(stringify(obj)).toBe('{"a":{"b":{"c":1}}}'); + }); + + it("should stringify objects with mixed types", () => { + const obj = { + string: "value", + number: 42, + boolean: true, + null: null, + bigint: BigInt(999), + }; + expect(stringify(obj)).toBe( + '{"string":"value","number":42,"boolean":true,"null":null,"bigint":"999n"}' + ); + }); + }); + + describe("arrays", () => { + it("should stringify simple arrays", () => { + expect(stringify([1, 2, 3])).toBe("[1,2,3]"); + }); + + it("should stringify empty arrays", () => { + expect(stringify([])).toBe("[]"); + }); + + it("should stringify nested arrays", () => { + expect(stringify([[1, 2], [3, 4]])).toBe("[[1,2],[3,4]]"); + }); + + it("should stringify arrays with mixed types", () => { + const arr = ["string", 42, true, null, BigInt(123)]; + expect(stringify(arr)).toBe('["string",42,true,null,"123n"]'); + }); + }); + + describe("complex structures", () => { + it("should handle deeply nested structures", () => { + const complex = { + level1: { + level2: { + level3: [BigInt(1), { value: BigInt(2) }], + }, + }, + }; + expect(stringify(complex)).toBe( + '{"level1":{"level2":{"level3":["1n",{"value":"2n"}]}}}' + ); + }); + }); +}); From 06aa4c42d71852e2a64ce175765794ca9042c234 Mon Sep 17 00:00:00 2001 From: "gitauto-ai[bot]" <161652217+gitauto-ai[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:17:16 +0000 Subject: [PATCH 3/5] Replace content of utils/transform.test.ts [skip ci] --- utils/transform.test.ts | 253 +++++++++++++++++++++++++++++++--------- 1 file changed, 200 insertions(+), 53 deletions(-) diff --git a/utils/transform.test.ts b/utils/transform.test.ts index e09b9ae..0dbc7ce 100644 --- a/utils/transform.test.ts +++ b/utils/transform.test.ts @@ -3,126 +3,273 @@ import { stringify } from "./transform"; describe("stringify", () => { describe("primitive types", () => { it("should stringify strings", () => { - expect(stringify("hello")).toBe('"hello"'); - expect(stringify("")).toBe('""'); - expect(stringify("with spaces")).toBe('"with spaces"'); + expect(stringify("hello")).toBe(JSON.stringify("hello")); + expect(stringify("")).toBe(JSON.stringify("")); + expect(stringify("with spaces")).toBe(JSON.stringify("with spaces")); }); it("should stringify numbers", () => { - expect(stringify(42)).toBe("42"); - expect(stringify(0)).toBe("0"); - expect(stringify(-1)).toBe("-1"); - expect(stringify(3.14)).toBe("3.14"); + expect(stringify(42)).toBe(JSON.stringify(42)); + expect(stringify(0)).toBe(JSON.stringify(0)); + expect(stringify(-1)).toBe(JSON.stringify(-1)); + expect(stringify(3.14)).toBe(JSON.stringify(3.14)); + expect(stringify(Infinity)).toBe(JSON.stringify(Infinity)); + expect(stringify(-Infinity)).toBe(JSON.stringify(-Infinity)); + expect(stringify(NaN)).toBe(JSON.stringify(NaN)); }); it("should stringify booleans", () => { - expect(stringify(true)).toBe("true"); - expect(stringify(false)).toBe("false"); + expect(stringify(true)).toBe(JSON.stringify(true)); + expect(stringify(false)).toBe(JSON.stringify(false)); }); - it("should stringify null", () => { - expect(stringify(null)).toBe("null"); - }); - - it("should stringify undefined", () => { - expect(stringify(undefined)).toBe(undefined); + it("should stringify null and undefined", () => { + expect(stringify(null)).toBe(JSON.stringify(null)); + expect(stringify(undefined)).toBe(JSON.stringify(undefined)); }); }); describe("bigint handling", () => { - it("should convert bigint to string with 'n' suffix", () => { + it("should stringify bigint with n suffix", () => { expect(stringify(BigInt(123))).toBe('"123n"'); expect(stringify(BigInt(0))).toBe('"0n"'); expect(stringify(BigInt(-456))).toBe('"-456n"'); }); - it("should handle large bigint values", () => { + it("should stringify large bigint values", () => { const largeBigInt = BigInt("9007199254740991"); expect(stringify(largeBigInt)).toBe('"9007199254740991n"'); + + const veryLargeBigInt = BigInt("123456789012345678901234567890"); + expect(stringify(veryLargeBigInt)).toBe( + '"123456789012345678901234567890n"' + ); }); - it("should handle bigint in objects", () => { + it("should stringify objects containing bigint", () => { const obj = { id: BigInt(123), name: "test" }; expect(stringify(obj)).toBe('{"id":"123n","name":"test"}'); }); - it("should handle bigint in arrays", () => { + it("should stringify arrays containing bigint", () => { const arr = [BigInt(1), BigInt(2), BigInt(3)]; expect(stringify(arr)).toBe('["1n","2n","3n"]'); }); - it("should handle multiple bigints in nested structures", () => { - const obj = { + it("should stringify nested structures with bigint", () => { + const nested = { user: { - id: BigInt(123), - balance: BigInt(1000), + id: BigInt(999), + balance: BigInt(1000000), }, items: [BigInt(1), BigInt(2)], }; - expect(stringify(obj)).toBe( - '{"user":{"id":"123n","balance":"1000n"},"items":["1n","2n"]}' + expect(stringify(nested)).toBe( + '{"user":{"id":"999n","balance":"1000000n"},"items":["1n","2n"]}' + ); + }); + + it("should stringify mixed types with bigint", () => { + const mixed = { + bigIntValue: BigInt(42), + numberValue: 42, + stringValue: "42", + boolValue: true, + nullValue: null, + }; + expect(stringify(mixed)).toBe( + '{"bigIntValue":"42n","numberValue":42,"stringValue":"42","boolValue":true,"nullValue":null}' ); }); }); describe("objects", () => { - it("should stringify simple objects", () => { - expect(stringify({ a: 1, b: 2 })).toBe('{"a":1,"b":2}'); + it("should stringify empty objects", () => { + expect(stringify({})).toBe(JSON.stringify({})); }); - it("should stringify empty objects", () => { - expect(stringify({})).toBe("{}"); + it("should stringify simple objects", () => { + const obj = { name: "John", age: 30 }; + expect(stringify(obj)).toBe(JSON.stringify(obj)); }); it("should stringify nested objects", () => { - const obj = { a: { b: { c: 1 } } }; - expect(stringify(obj)).toBe('{"a":{"b":{"c":1}}}'); + const nested = { + user: { + name: "Alice", + address: { + city: "NYC", + zip: "10001", + }, + }, + }; + expect(stringify(nested)).toBe(JSON.stringify(nested)); }); - it("should stringify objects with mixed types", () => { + it("should stringify objects with various value types", () => { const obj = { - string: "value", - number: 42, - boolean: true, - null: null, - bigint: BigInt(999), + str: "text", + num: 123, + bool: true, + nil: null, + arr: [1, 2, 3], + obj: { nested: "value" }, }; - expect(stringify(obj)).toBe( - '{"string":"value","number":42,"boolean":true,"null":null,"bigint":"999n"}' - ); + expect(stringify(obj)).toBe(JSON.stringify(obj)); }); }); describe("arrays", () => { - it("should stringify simple arrays", () => { - expect(stringify([1, 2, 3])).toBe("[1,2,3]"); + it("should stringify empty arrays", () => { + expect(stringify([])).toBe(JSON.stringify([])); }); - it("should stringify empty arrays", () => { - expect(stringify([])).toBe("[]"); + it("should stringify arrays of primitives", () => { + expect(stringify([1, 2, 3])).toBe(JSON.stringify([1, 2, 3])); + expect(stringify(["a", "b", "c"])).toBe(JSON.stringify(["a", "b", "c"])); + expect(stringify([true, false])).toBe(JSON.stringify([true, false])); + }); + + it("should stringify arrays of objects", () => { + const arr = [ + { id: 1, name: "first" }, + { id: 2, name: "second" }, + ]; + expect(stringify(arr)).toBe(JSON.stringify(arr)); }); it("should stringify nested arrays", () => { - expect(stringify([[1, 2], [3, 4]])).toBe("[[1,2],[3,4]]"); + const nested = [ + [1, 2], + [3, 4], + [5, 6], + ]; + expect(stringify(nested)).toBe(JSON.stringify(nested)); }); - it("should stringify arrays with mixed types", () => { - const arr = ["string", 42, true, null, BigInt(123)]; - expect(stringify(arr)).toBe('["string",42,true,null,"123n"]'); + it("should stringify mixed type arrays", () => { + const mixed = [1, "two", true, null, { key: "value" }]; + expect(stringify(mixed)).toBe(JSON.stringify(mixed)); }); }); - describe("complex structures", () => { - it("should handle deeply nested structures", () => { - const complex = { + describe("edge cases", () => { + it("should handle objects with special characters in keys", () => { + const obj = { "key with spaces": "value", "key-with-dashes": "value2" }; + expect(stringify(obj)).toBe(JSON.stringify(obj)); + }); + + it("should handle empty strings in objects", () => { + const obj = { key: "" }; + expect(stringify(obj)).toBe(JSON.stringify(obj)); + }); + + it("should handle Date objects", () => { + const date = new Date("2026-01-16T00:00:00.000Z"); + expect(stringify(date)).toBe(JSON.stringify(date)); + }); + + it("should handle arrays with bigint and other types", () => { + const arr = [BigInt(1), "string", 42, true, null, { key: "value" }]; + expect(stringify(arr)).toBe( + '["1n","string",42,true,null,{"key":"value"}]' + ); + }); + + it("should handle deeply nested structures with bigint", () => { + const deep = { level1: { level2: { - level3: [BigInt(1), { value: BigInt(2) }], + level3: { + id: BigInt(123), + data: [BigInt(1), BigInt(2)], + }, }, }, }; + expect(stringify(deep)).toBe( + '{"level1":{"level2":{"level3":{"id":"123n","data":["1n","2n"]}}}}' + ); + }); + + it("should handle objects with numeric keys", () => { + const obj = { 0: "zero", 1: "one", 2: "two" }; + expect(stringify(obj)).toBe(JSON.stringify(obj)); + }); + + it("should handle arrays with undefined and null", () => { + const arr = [1, undefined, null, 4]; + expect(stringify(arr)).toBe(JSON.stringify(arr)); + }); + + it("should handle objects with undefined values", () => { + const obj = { a: 1, b: undefined, c: 3 }; + expect(stringify(obj)).toBe(JSON.stringify(obj)); + }); + + it("should handle negative bigint values", () => { + const obj = { + positive: BigInt(100), + negative: BigInt(-100), + zero: BigInt(0), + }; + expect(stringify(obj)).toBe( + '{"positive":"100n","negative":"-100n","zero":"0n"}' + ); + }); + }); + + describe("corner cases", () => { + it("should handle empty nested structures", () => { + const obj = { empty: {}, emptyArr: [], nested: { inner: {} } }; + expect(stringify(obj)).toBe(JSON.stringify(obj)); + }); + + it("should handle special number values in objects", () => { + const obj = { + infinity: Infinity, + negInfinity: -Infinity, + nan: NaN, + regular: 42, + }; + expect(stringify(obj)).toBe(JSON.stringify(obj)); + }); + + it("should handle bigint in complex nested array", () => { + const arr = [ + [BigInt(1), BigInt(2)], + [BigInt(3), BigInt(4)], + ]; + expect(stringify(arr)).toBe('[["1n","2n"],["3n","4n"]]'); + }); + + it("should handle object with only bigint values", () => { + const obj = { + a: BigInt(1), + b: BigInt(2), + c: BigInt(3), + }; + expect(stringify(obj)).toBe('{"a":"1n","b":"2n","c":"3n"}'); + }); + + it("should handle array with only bigint values", () => { + const arr = [BigInt(10), BigInt(20), BigInt(30)]; + expect(stringify(arr)).toBe('["10n","20n","30n"]'); + }); + + it("should handle mixed nested structures", () => { + const complex = { + users: [ + { id: BigInt(1), name: "Alice", active: true }, + { id: BigInt(2), name: "Bob", active: false }, + ], + metadata: { + count: 2, + total: BigInt(1000), + }, + }; expect(stringify(complex)).toBe( - '{"level1":{"level2":{"level3":["1n",{"value":"2n"}]}}}' + '{"users":[{"id":"1n","name":"Alice","active":true},{"id":"2n","name":"Bob","active":false}],"metadata":{"count":2,"total":"1000n"}}' ); }); }); From 904c8b35d8df6dbf2cbd7ba1552bdf858192a681 Mon Sep 17 00:00:00 2001 From: "gitauto-ai[bot]" <161652217+gitauto-ai[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:18:05 +0000 Subject: [PATCH 4/5] Replace content of utils/transform.test.ts [skip ci] --- utils/transform.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/transform.test.ts b/utils/transform.test.ts index 0dbc7ce..ffc2e69 100644 --- a/utils/transform.test.ts +++ b/utils/transform.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-var-requires */ import { stringify } from "./transform"; describe("stringify", () => { From 1b250620d00ed828fb6bff95adb98c3a98b86e6d Mon Sep 17 00:00:00 2001 From: "gitauto-ai[bot]" <161652217+gitauto-ai[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:18:07 +0000 Subject: [PATCH 5/5] Empty commit to trigger final tests