Esempio n. 1
0
export const receiveRecommendedSitesResponse = ( store, action, response ) => {
	if ( ! response.sites ) {
		return;
	}

	store.dispatch(
		receiveRecommendedSites( {
			sites: fromApi( response ),
			seed: action.payload.seed,
			offset: action.payload.offset,
		} )
	);
};
Esempio n. 2
0
		test( 'should dispatch action with sites if successful', () => {
			const dispatch = spy();
			const action = requestRecommendedSitesAction( { seed } );

			receiveRecommendedSitesResponse( { dispatch }, action, response );
			expect( dispatch ).calledWith(
				receiveRecommendedSites( {
					sites: fromApi( response ),
					seed,
					offset: 0,
				} )
			);
		} );