mirror of
https://github.com/gosticks/web.git
synced 2026-10-06 06:37:07 +00:00
Remove fetchMock from SummaryStats tests
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user