1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

Errors from stylelint as warnings, fixed jest mock

This commit is contained in:
Vladimir Volek 2018-09-12 17:12:52 +02:00
parent a8cf778e23
commit bd86bb22f9
8 changed files with 40 additions and 12 deletions

View File

@ -1,5 +1,6 @@
module.exports = {
rootDir: './src',
automock: false,
coverageDirectory: 'coverage/',
collectCoverage: true,
testURL: 'http://localhost',
@ -10,4 +11,7 @@ module.exports = {
collectCoverageFrom: [
'utils/**.js',
],
setupFiles: [
'./support/setupJest.js',
],
};

View File

@ -34,6 +34,7 @@
"flow-webpack-plugin": "^1.2.0",
"hdkey": "^0.8.0",
"html-webpack-plugin": "^3.2.0",
"jest-fetch-mock": "^1.6.5",
"npm-run-all": "^4.1.3",
"prop-types": "^15.6.2",
"raf": "^3.4.0",

1
src/support/setupJest.js Normal file
View File

@ -0,0 +1 @@
global.fetch = require('jest-fetch-mock');

View File

@ -0,0 +1,15 @@
import * as networkUtils from '../networkUtils';
describe('network utils', () => {
beforeEach(() => {
fetch.resetMocks();
});
it('httpRequest', () => {
});
it('JSONRequest', () => {
});
});

View File

@ -1,6 +1,5 @@
/* @flow */
import 'whatwg-fetch';
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();
}
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> => {

View File

@ -48,6 +48,7 @@ module.exports = {
{
loader: 'stylelint-custom-processor-loader',
options: {
emitWarning: true,
configPath: '.stylelintrc',
},
},

View File

@ -59,6 +59,7 @@ module.exports = {
{
loader: 'stylelint-custom-processor-loader',
options: {
emitWarning: true,
configPath: '.stylelintrc',
},
},

View File

@ -255,6 +255,10 @@
version "0.7.0"
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":
version "1.5.13"
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"
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"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
dependencies:
@ -5522,6 +5526,14 @@ jest-environment-node@^23.4.0:
jest-mock "^23.2.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:
version "22.4.3"
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"
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:
version "7.3.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"