mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-31 01:26:16 +00:00
Improved performance while calculating status by doing one iteration only and memoizing the result when possible
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user