mirror of
https://github.com/usatiuk/photos.git
synced 2025-10-28 23:37:48 +01:00
fix Overview tests
This commit is contained in:
@@ -33,7 +33,6 @@ export const OverviewComponent: React.FunctionComponent<IOverviewComponentProps>
|
||||
|
||||
return (
|
||||
<div id="overview">
|
||||
{" "}
|
||||
<div className="list">{photos}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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("<Overview />", () => {
|
||||
it("should not crash", () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it("should not crash and call fetchPhotos", () => {
|
||||
const wrapper = shallow(
|
||||
<OverviewComponent {...overviewComponentDefaultProps} />,
|
||||
);
|
||||
expect(wrapper.contains("Overview!")).toBeTruthy();
|
||||
expect(fetchPhotosFn).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user