Skip to content

Commit

Permalink
add a spec for negative number
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark committed Oct 26, 2022
1 parent 28ee764 commit 13db562
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,17 @@ describe('parseResponse()', () => {

it('resolves to big number value if `parseMethod=json-bigint`', async () => {
const mockBigIntUrl = '/mock/get/bigInt';
const mockGetBigIntPayload = '{ "value": 9223372036854775807 }';
const mockGetBigIntPayload =
'{ "value": 9223372036854775807, "minusValue": -483729382918228373892 }';
fetchMock.get(mockBigIntUrl, mockGetBigIntPayload);
const responseBigNumber = await parseResponse(
callApi({ url: mockBigIntUrl, method: 'GET' }),
'json-bigint',
);
expect(`${responseBigNumber.json.value}`).toEqual('9223372036854775807');
expect(`${responseBigNumber.json.minusValue}`).toEqual(
'-483729382918228373892',
);
});

it('rejects if request.ok=false', async () => {
Expand Down

0 comments on commit 13db562

Please sign in to comment.