Skip to content

Commit ef60b6b

Browse files
committed
Add unit tests for jsonpretty big number rendering
1 parent a3eb706 commit ef60b6b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

redisinsight/ui/src/components/json-viewer/components/json-pretty/JsonPretty.spec.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react'
2+
import JSONBigInt from 'json-bigint'
23
import { render, screen } from 'uiSrc/utils/test-utils'
34

45
import JsonPretty from './JsonPretty'
@@ -24,4 +25,16 @@ describe('JsonPretty', () => {
2425

2526
expect(screen.getByTestId('json-primitive-component')).toBeInTheDocument()
2627
})
28+
29+
it('should render json primitive component with big number', () => {
30+
const json = JSONBigInt({ useNativeBigInt: true }).parse('1234567890123456789012345678901234567890}')
31+
render(<JsonPretty data={json} />)
32+
expect(screen.getByTestId('json-primitive-component')).toBeInTheDocument()
33+
})
34+
35+
it('should render json primitive component with big float', () => {
36+
const json = JSONBigInt({ useNativeBigInt: false }).parse('1234567890123456789012345678901234567890.1234567890123456789012345678901234567890')
37+
render(<JsonPretty data={json} />)
38+
expect(screen.getByTestId('json-primitive-component')).toBeInTheDocument()
39+
})
2740
})

0 commit comments

Comments
 (0)