1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-07-13 18:18:09 +00:00
trezor-wallet/src/utils/__tests__/networkUtils.test.js
2018-09-13 13:08:25 +02:00

20 lines
615 B
JavaScript

import * as networkUtils from '../networkUtils';
describe('network utils', () => {
beforeEach(() => {
fetch.resetMocks();
});
it('httpRequest json ok response', async () => {
fetch.mockResponse(JSON.stringify({ test_json: '12345' }));
const result = await networkUtils.httpRequest('/test/', 'json');
expect(result).toMatchSnapshot();
});
it('JSONRequest ok', async () => {
fetch.mockResponse(JSON.stringify({ test_json: '01234' }));
const result = await networkUtils.JSONRequest('/test/');
expect(result).toMatchSnapshot();
});
});