From e1411b1c1ff1b11b10153a963c395fab97ab04c0 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Wed, 14 Oct 2020 21:30:32 +0300 Subject: [PATCH] fix Overview tests --- frontend/src/Photos/Overview.tsx | 1 - frontend/src/Photos/tests/Overview.test.tsx | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/Photos/Overview.tsx b/frontend/src/Photos/Overview.tsx index 7bbebaf..322aa17 100644 --- a/frontend/src/Photos/Overview.tsx +++ b/frontend/src/Photos/Overview.tsx @@ -33,7 +33,6 @@ export const OverviewComponent: React.FunctionComponent return (
- {" "}
{photos}
); diff --git a/frontend/src/Photos/tests/Overview.test.tsx b/frontend/src/Photos/tests/Overview.test.tsx index bea70e6..a66b008 100644 --- a/frontend/src/Photos/tests/Overview.test.tsx +++ b/frontend/src/Photos/tests/Overview.test.tsx @@ -7,20 +7,26 @@ afterEach(() => { jest.restoreAllMocks(); }); +const fetchPhotosFn = jest.fn(); + const overviewComponentDefaultProps: IOverviewComponentProps = { photos: null, fetching: false, fetchingError: null, fetchingSpinner: false, - fetchPhotos: jest.fn(), + fetchPhotos: fetchPhotosFn, }; describe("", () => { - it("should not crash", () => { + afterEach(() => { + jest.clearAllMocks(); + }); + + it("should not crash and call fetchPhotos", () => { const wrapper = shallow( , ); - expect(wrapper.contains("Overview!")).toBeTruthy(); + expect(fetchPhotosFn).toHaveBeenCalled(); }); });