Improved performance while calculating status by doing one iteration only and memoizing the result when possible

This commit is contained in:
Alejandro Celaya
2019-03-04 18:14:45 +01:00
parent 9a6fad4db5
commit 252edaa2ca
8 changed files with 118 additions and 127 deletions

View File

@@ -11,21 +11,16 @@ import SortableBarGraph from '../../src/visits/SortableBarGraph';
describe('<ShortUrlVisits />', () => {
let wrapper;
const statsProcessor = () => ({});
const processStatsFromVisits = () => (
{ os: {}, browsers: {}, referrers: {}, countries: {}, cities: {}, citiesForMap: {} }
);
const getShortUrlVisitsMock = sinon.spy();
const match = {
params: { shortCode: 'abc123' },
};
const createComponent = (shortUrlVisits) => {
const ShortUrlVisits = createShortUrlVisits({
processBrowserStats: statsProcessor,
processCountriesStats: statsProcessor,
processOsStats: statsProcessor,
processReferrersStats: statsProcessor,
processCitiesStats: statsProcessor,
processCitiesStatsForMap: statsProcessor,
});
const ShortUrlVisits = createShortUrlVisits({ processStatsFromVisits });
wrapper = shallow(
<ShortUrlVisits