Remove fetchMock from SummaryStats tests

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12
2018-11-09 23:58:34 -05:00
parent 309bcabf9b
commit 2b8feb0808
2 changed files with 4 additions and 7 deletions
+3
View File
@@ -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
*
@@ -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(
<TranslatedSummaryStats {...transformData(fakeData)} />
);
@@ -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(<TranslatedSummaryStats {...errorState()} />);
await tick();