Skip to content

Commit 96114cb

Browse files
committed
test: add tests for large integers
Co-authored-by: Yarchik spoko.dev@gmail.com Ref: #56
1 parent f4537b6 commit 96114cb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

test/stringify.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,22 @@ a = 100
5757
expect(stringify({ a: 100 })).toBe(expected)
5858
})
5959

60-
it('stringifies integers as floats', () => {
60+
it('stringifies integers as floats with numbersAsFloat', () => {
6161
const expected = `
6262
a = 100.0
6363
`.trimStart()
6464

6565
expect(stringify({ a: 100 }, { numbersAsFloat: true })).toBe(expected)
6666
})
6767

68+
it('stringifies very large integers as floats', () => {
69+
const expected = `
70+
a = 36028797018963968.0
71+
`.trimStart()
72+
73+
expect(stringify({ a: 2 ** 55 }, { numbersAsFloat: true })).toBe(expected)
74+
})
75+
6876
it('stringifies floats as floats', () => {
6977
const expected = `
7078
a = 100.146

0 commit comments

Comments
 (0)