mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
ListingPage uses storableError func and correct proptype validation.
This commit is contained in:
parent
d0a1cafc1b
commit
ee051c510a
3 changed files with 8 additions and 6 deletions
|
|
@ -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)));
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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))],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue