mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
Added tests for network utils
This commit is contained in:
parent
bd86bb22f9
commit
2cfb955e62
@ -7,6 +7,7 @@ module.exports = {
|
|||||||
modulePathIgnorePatterns: [
|
modulePathIgnorePatterns: [
|
||||||
'node_modules',
|
'node_modules',
|
||||||
'utils/windowUtils.js',
|
'utils/windowUtils.js',
|
||||||
|
'utils/promiseUtils.js',
|
||||||
],
|
],
|
||||||
collectCoverageFrom: [
|
collectCoverageFrom: [
|
||||||
'utils/**.js',
|
'utils/**.js',
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
"styled-components": "^3.3.3",
|
"styled-components": "^3.3.3",
|
||||||
"styled-media-query": "^2.0.2",
|
"styled-media-query": "^2.0.2",
|
||||||
"styled-normalize": "^8.0.0",
|
"styled-normalize": "^8.0.0",
|
||||||
"trezor-connect": "5.0.30",
|
"trezor-connect": "../connect/src/index.js",
|
||||||
"web3": "^0.19.0",
|
"web3": "^0.19.0",
|
||||||
"webpack": "^4.16.3",
|
"webpack": "^4.16.3",
|
||||||
"webpack-bundle-analyzer": "^2.13.1",
|
"webpack-bundle-analyzer": "^2.13.1",
|
||||||
|
13
src/utils/__tests__/__snapshots__/networkUtils.test.js.snap
Normal file
13
src/utils/__tests__/__snapshots__/networkUtils.test.js.snap
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`network utils JSONRequest ok 1`] = `
|
||||||
|
Object {
|
||||||
|
"test_json": "01234",
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`network utils httpRequest json ok response 1`] = `
|
||||||
|
Object {
|
||||||
|
"test_json": "12345",
|
||||||
|
}
|
||||||
|
`;
|
@ -5,11 +5,15 @@ describe('network utils', () => {
|
|||||||
fetch.resetMocks();
|
fetch.resetMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('httpRequest', () => {
|
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', () => {
|
it('JSONRequest ok', async () => {
|
||||||
|
fetch.mockResponse(JSON.stringify({ test_json: '01234' }));
|
||||||
|
const result = await networkUtils.JSONRequest('/test/');
|
||||||
|
expect(result).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user