mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
Errors from stylelint as warnings, fixed jest mock
This commit is contained in:
parent
a8cf778e23
commit
bd86bb22f9
@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
rootDir: './src',
|
rootDir: './src',
|
||||||
|
automock: false,
|
||||||
coverageDirectory: 'coverage/',
|
coverageDirectory: 'coverage/',
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
testURL: 'http://localhost',
|
testURL: 'http://localhost',
|
||||||
@ -10,4 +11,7 @@ module.exports = {
|
|||||||
collectCoverageFrom: [
|
collectCoverageFrom: [
|
||||||
'utils/**.js',
|
'utils/**.js',
|
||||||
],
|
],
|
||||||
|
setupFiles: [
|
||||||
|
'./support/setupJest.js',
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
"flow-webpack-plugin": "^1.2.0",
|
"flow-webpack-plugin": "^1.2.0",
|
||||||
"hdkey": "^0.8.0",
|
"hdkey": "^0.8.0",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
|
"jest-fetch-mock": "^1.6.5",
|
||||||
"npm-run-all": "^4.1.3",
|
"npm-run-all": "^4.1.3",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"raf": "^3.4.0",
|
"raf": "^3.4.0",
|
||||||
|
1
src/support/setupJest.js
Normal file
1
src/support/setupJest.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
global.fetch = require('jest-fetch-mock');
|
15
src/utils/__tests__/networkUtils.test.js
Normal file
15
src/utils/__tests__/networkUtils.test.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import * as networkUtils from '../networkUtils';
|
||||||
|
|
||||||
|
describe('network utils', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
fetch.resetMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('httpRequest', () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('JSONRequest', () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
@ -1,6 +1,5 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
|
|
||||||
|
|
||||||
import 'whatwg-fetch';
|
import 'whatwg-fetch';
|
||||||
|
|
||||||
export const httpRequest = async (url: string, type: string = 'text'): any => {
|
export const httpRequest = async (url: string, type: string = 'text'): any => {
|
||||||
@ -15,16 +14,6 @@ export const httpRequest = async (url: string, type: string = 'text'): any => {
|
|||||||
await response.text();
|
await response.text();
|
||||||
}
|
}
|
||||||
throw new Error(`${url} ${response.statusText}`);
|
throw new Error(`${url} ${response.statusText}`);
|
||||||
|
|
||||||
|
|
||||||
// return fetch(url, { credentials: 'same-origin' }).then((response) => {
|
|
||||||
// if (response.status === 200) {
|
|
||||||
|
|
||||||
// return response.text().then(result => (json ? JSON.parse(result) : result));
|
|
||||||
// } else {
|
|
||||||
// throw new Error(response.statusText);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const JSONRequest = async (url: string): Promise<JSON> => {
|
export const JSONRequest = async (url: string): Promise<JSON> => {
|
||||||
|
@ -48,6 +48,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
loader: 'stylelint-custom-processor-loader',
|
loader: 'stylelint-custom-processor-loader',
|
||||||
options: {
|
options: {
|
||||||
|
emitWarning: true,
|
||||||
configPath: '.stylelintrc',
|
configPath: '.stylelintrc',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -59,6 +59,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
loader: 'stylelint-custom-processor-loader',
|
loader: 'stylelint-custom-processor-loader',
|
||||||
options: {
|
options: {
|
||||||
|
emitWarning: true,
|
||||||
configPath: '.stylelintrc',
|
configPath: '.stylelintrc',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
18
yarn.lock
18
yarn.lock
@ -255,6 +255,10 @@
|
|||||||
version "0.7.0"
|
version "0.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
|
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
|
||||||
|
|
||||||
|
"@types/jest@^23.0.0":
|
||||||
|
version "23.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-23.3.2.tgz#07b90f6adf75d42c34230c026a2529e56c249dbb"
|
||||||
|
|
||||||
"@webassemblyjs/ast@1.5.13":
|
"@webassemblyjs/ast@1.5.13":
|
||||||
version "1.5.13"
|
version "1.5.13"
|
||||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.13.tgz#81155a570bd5803a30ec31436bc2c9c0ede38f25"
|
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.13.tgz#81155a570bd5803a30ec31436bc2c9c0ede38f25"
|
||||||
@ -5330,7 +5334,7 @@ isobject@^3.0.0, isobject@^3.0.1:
|
|||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
|
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
|
||||||
|
|
||||||
isomorphic-fetch@^2.1.1:
|
isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1:
|
||||||
version "2.2.1"
|
version "2.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
|
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -5522,6 +5526,14 @@ jest-environment-node@^23.4.0:
|
|||||||
jest-mock "^23.2.0"
|
jest-mock "^23.2.0"
|
||||||
jest-util "^23.4.0"
|
jest-util "^23.4.0"
|
||||||
|
|
||||||
|
jest-fetch-mock@^1.6.5:
|
||||||
|
version "1.6.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/jest-fetch-mock/-/jest-fetch-mock-1.6.5.tgz#178fa1a937ef6f61fb8e8483b6d4602b17e0d96d"
|
||||||
|
dependencies:
|
||||||
|
"@types/jest" "^23.0.0"
|
||||||
|
isomorphic-fetch "^2.2.1"
|
||||||
|
promise-polyfill "^7.1.1"
|
||||||
|
|
||||||
jest-get-type@^22.1.0:
|
jest-get-type@^22.1.0:
|
||||||
version "22.4.3"
|
version "22.4.3"
|
||||||
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4"
|
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4"
|
||||||
@ -7711,6 +7723,10 @@ promise-inflight@^1.0.1:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
|
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
|
||||||
|
|
||||||
|
promise-polyfill@^7.1.1:
|
||||||
|
version "7.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-7.1.2.tgz#ab05301d8c28536301622d69227632269a70ca3b"
|
||||||
|
|
||||||
promise@^7.1.1:
|
promise@^7.1.1:
|
||||||
version "7.3.1"
|
version "7.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"
|
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"
|
||||||
|
Loading…
Reference in New Issue
Block a user