From 2b8feb0808a2f686988fa33a7ecf17c4477590f7 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 9 Nov 2018 23:58:34 -0500 Subject: [PATCH] Remove fetchMock from SummaryStats tests Signed-off-by: Mcat12 --- src/components/common/WithAPIData.js | 3 +++ src/components/dashboard/SummaryStats.test.js | 8 +------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/common/WithAPIData.js b/src/components/common/WithAPIData.js index e658194..0376448 100644 --- a/src/components/common/WithAPIData.js +++ b/src/components/common/WithAPIData.js @@ -23,10 +23,12 @@ export class WithAPIData extends Component { ignoreCancel: PropTypes.bool, interval: PropTypes.number }), + /** * Render the children before the first API request is done */ renderInitial: PropTypes.func.isRequired, + /** * Render the children if the API request succeeded * @@ -34,6 +36,7 @@ export class WithAPIData extends Component { * @param refresh a function to trigger an asynchronous data refresh */ renderOk: PropTypes.func.isRequired, + /** * Render the children if the API request failed * diff --git a/src/components/dashboard/SummaryStats.test.js b/src/components/dashboard/SummaryStats.test.js index 40495c2..cea66fb 100644 --- a/src/components/dashboard/SummaryStats.test.js +++ b/src/components/dashboard/SummaryStats.test.js @@ -10,14 +10,12 @@ import React from "react"; import { shallow } from "enzyme"; -import fetchMock from "fetch-mock"; import { TranslatedSummaryStats, transformData, errorState } from "./SummaryStats"; -const endpoint = "/admin/api/stats/summary"; const fakeData = { domains_blocked: 10193, total_queries: 58787, @@ -32,8 +30,6 @@ const fakeData = { }; it("displays summary stats correctly", async () => { - fetchMock.mock(endpoint, fakeData); - const wrapper = shallow( ); @@ -55,9 +51,7 @@ it("displays summary stats correctly", async () => { ); }); -it("displays an error message on error", async () => { - fetchMock.mock(endpoint, { error: {} }); - +it("displays error message correctly", async () => { const wrapper = shallow(); await tick();