mirror of
https://github.com/usatiuk/photos.git
synced 2025-10-28 23:37:48 +01:00
fix tests
This commit is contained in:
@@ -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],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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 />", () => {
|
||||
|
||||
Reference in New Issue
Block a user