From 06f5c65b9f2e86b9b6016b2df71594c5fd4f9108 Mon Sep 17 00:00:00 2001 From: Joe Farro Date: Wed, 25 Oct 2017 16:26:32 -0400 Subject: [PATCH] Fix #105 test error, fetch requires absolute urls Signed-off-by: Joe Farro --- src/actions/jaeger-api.test.js | 12 ++++++++++-- src/middlewares/index.test.js | 12 +++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/actions/jaeger-api.test.js b/src/actions/jaeger-api.test.js index d26c677b50..aad70b1044 100644 --- a/src/actions/jaeger-api.test.js +++ b/src/actions/jaeger-api.test.js @@ -12,12 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +/* eslint-disable import/first */ +jest.mock('node-fetch', () => () => + Promise.resolve({ + status: 200, + data: () => Promise.resolve({ data: null }), + json: () => Promise.resolve({ data: null }), + }) +); + import sinon from 'sinon'; import isPromise from 'is-promise'; -import JaegerAPI from '../api/jaeger'; - import * as jaegerApiActions from './jaeger-api'; +import JaegerAPI from '../api/jaeger'; it('@JAEGER_API/FETCH_TRACE should fetch the trace by id', () => { const api = JaegerAPI; diff --git a/src/middlewares/index.test.js b/src/middlewares/index.test.js index 62b66fd596..233d0e0b09 100644 --- a/src/middlewares/index.test.js +++ b/src/middlewares/index.test.js @@ -12,8 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -import sinon from 'sinon'; +/* eslint-disable import/first */ +jest.mock('node-fetch', () => () => + Promise.resolve({ + status: 200, + data: () => Promise.resolve({ data: null }), + json: () => Promise.resolve({ data: null }), + }) +); + import { change } from 'redux-form'; +import sinon from 'sinon'; + import * as jaegerMiddlewares from './index'; import { fetchServiceOperations } from '../actions/jaeger-api';