ListingPage uses storableError func and correct proptype validation.

This commit is contained in:
Vesa Luusua 2017-10-17 19:41:34 +03:00
parent d0a1cafc1b
commit ee051c510a
3 changed files with 8 additions and 6 deletions

View file

@ -1,3 +1,4 @@
import { storableError } from '../../util/errors';
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
import { fetchCurrentUser } from '../../ducks/user.duck';
@ -50,6 +51,6 @@ export const showListing = listingId => (dispatch, getState, sdk) => {
return data;
})
.catch(e => {
dispatch(showListingError(e));
dispatch(showListingError(storableError(e)));
});
};

View file

@ -83,7 +83,7 @@ export const ActionBar = props => {
}
};
const { bool, func, instanceOf, object, oneOf, shape, string } = PropTypes;
const { bool, func, object, oneOf, shape, string } = PropTypes;
ActionBar.propTypes = {
isOwnListing: bool.isRequired,
@ -495,13 +495,13 @@ ListingPageComponent.propTypes = {
id: string.isRequired,
slug: string,
}).isRequired,
authInfoError: instanceOf(Error),
authInfoError: propTypes.error,
currentUser: propTypes.currentUser,
getListing: func.isRequired,
logoutError: instanceOf(Error),
logoutError: propTypes.error,
onManageDisableScrolling: func.isRequired,
scrollingDisabled: bool.isRequired,
showListingError: instanceOf(Error),
showListingError: propTypes.error,
tab: oneOf(['book', 'listing']),
useInitialValues: func.isRequired,
};

View file

@ -3,6 +3,7 @@ import { shallow } from 'enzyme';
import { FormattedMessage } from 'react-intl';
import { types } from '../../util/sdkLoader';
import { createUser, createCurrentUser, createListing, fakeIntl } from '../../util/test-data';
import { storableError } from '../../util/errors';
import { renderShallow } from '../../util/test-helpers';
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
import { showListingRequest, showListingError, showListing } from './ListingPage.duck';
@ -84,7 +85,7 @@ describe('ListingPage', () => {
expect(dispatch.mock.calls).toEqual([
[showListingRequest(id)],
[expect.anything()], // fetchCurrentUser() call
[showListingError(error)],
[showListingError(storableError(error))],
]);
});
});