Skip to content

Commit 628f6fd

Browse files
Copilotstreamich
andcommitted
fix: resolve BigInt serialization issues in Jest tests
Co-authored-by: streamich <[email protected]>
1 parent 95a3924 commit 628f6fd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/structured/__tests__/TemplateJson.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,25 @@ describe('TemplateJson', () => {
6060
test('can specify int64 range', () => {
6161
resetMathRandom();
6262
const result1 = TemplateJson.gen(['int64', BigInt(-10), BigInt(10)]) as bigint;
63-
expect(result1).toBe(BigInt(-9));
63+
expect(result1.toString()).toBe('-9');
6464

6565
const result2 = TemplateJson.gen(['int64', BigInt(0), BigInt(1)]) as bigint;
66-
expect(result2).toBe(BigInt(0));
66+
expect(result2.toString()).toBe('0');
6767

6868
const result3 = TemplateJson.gen(['int64', BigInt(1), BigInt(5)]) as bigint;
69-
expect(result3).toBe(BigInt(4));
69+
expect(result3.toString()).toBe('3');
7070
});
7171

7272
test('handles edge cases', () => {
7373
resetMathRandom();
7474
const result1 = TemplateJson.gen(['int64', BigInt(0), BigInt(0)]) as bigint;
75-
expect(result1).toBe(BigInt(0));
75+
expect(result1.toString()).toBe('0');
7676

7777
const result2 = TemplateJson.gen(['int64', BigInt(-1), BigInt(-1)]) as bigint;
78-
expect(result2).toBe(BigInt(-1));
78+
expect(result2.toString()).toBe('-1');
7979

8080
const result3 = TemplateJson.gen(['int64', BigInt('1000000000000'), BigInt('1000000000000')]) as bigint;
81-
expect(result3).toBe(BigInt('1000000000000'));
81+
expect(result3.toString()).toBe('1000000000000');
8282
});
8383

8484
test('handles very large ranges', () => {

0 commit comments

Comments
 (0)