fix tests

This commit is contained in:
2022-05-02 22:09:35 +02:00
committed by Stepan Usatiuk
parent ff058b7487
commit 48aab3f160
2 changed files with 7 additions and 11 deletions

View File

@@ -120,18 +120,9 @@ export const PhotoComponent: React.FunctionComponent<IPhotoComponentProps> = (
function mapStateToProps(state: IAppState, props: IPhotoComponentProps) {
const { id } = props;
let photo = undefined;
let photoState = undefined;
if (state.photos.photos) {
photo = state.photos.photos.find((p) => p.id === id);
}
if (state.photos.photoStates[id]) {
photoState = state.photos.photoStates[id];
}
return {
photo,
photoState,
photo: state.photos?.photos?.find((p) => p.id === id),
photoState: state.photos?.photoStates?.[id],
};
}

View File

@@ -8,6 +8,8 @@ afterEach(() => {
});
const fetchPhotosFn = jest.fn();
const startDeletePhotosFn = jest.fn();
const cancelDeleteFn = jest.fn();
const overviewComponentDefaultProps: IOverviewComponentProps = {
photos: [],
@@ -16,8 +18,11 @@ const overviewComponentDefaultProps: IOverviewComponentProps = {
overviewFetching: false,
overviewFetchingError: null,
overviewFetchingSpinner: false,
darkMode: false,
fetchPhotos: fetchPhotosFn,
startDeletePhotos: startDeletePhotosFn,
cancelDelete: cancelDeleteFn,
};
describe("<Overview />", () => {