mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-23 06:56:22 +00:00
Added cities stats graphic on short url visits page
This commit is contained in:
@@ -23,6 +23,7 @@ describe('<ShortUrlVisits />', () => {
|
||||
processCountriesStats: statsProcessor,
|
||||
processOsStats: statsProcessor,
|
||||
processReferrersStats: statsProcessor,
|
||||
processCitiesStats: statsProcessor,
|
||||
});
|
||||
|
||||
wrapper = shallow(
|
||||
@@ -74,7 +75,7 @@ describe('<ShortUrlVisits />', () => {
|
||||
const wrapper = createComponent({ loading: false, error: false, visits: [{}, {}, {}] });
|
||||
const graphs = wrapper.find(GraphCard);
|
||||
const sortableBarGraphs = wrapper.find(SortableBarGraph);
|
||||
const expectedGraphsCount = 4;
|
||||
const expectedGraphsCount = 5;
|
||||
|
||||
expect(graphs.length + sortableBarGraphs.length).toEqual(expectedGraphsCount);
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
processBrowserStats,
|
||||
processReferrersStats,
|
||||
processCountriesStats,
|
||||
processCitiesStats,
|
||||
} from '../../../src/visits/services/VisitsParser';
|
||||
|
||||
describe('VisitsParser', () => {
|
||||
@@ -12,6 +13,7 @@ describe('VisitsParser', () => {
|
||||
referer: 'https://google.com',
|
||||
visitLocation: {
|
||||
countryName: 'Spain',
|
||||
cityName: 'Zaragoza',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -19,6 +21,7 @@ describe('VisitsParser', () => {
|
||||
referer: 'https://google.com',
|
||||
visitLocation: {
|
||||
countryName: 'United States',
|
||||
cityName: 'New York',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -32,6 +35,7 @@ describe('VisitsParser', () => {
|
||||
referer: 'https://m.facebook.com',
|
||||
visitLocation: {
|
||||
countryName: 'Spain',
|
||||
cityName: 'Zaragoza',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -78,4 +82,14 @@ describe('VisitsParser', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('processCitiesStats', () => {
|
||||
it('properly parses cities stats', () => {
|
||||
expect(processCitiesStats(visits)).toEqual({
|
||||
'Zaragoza': 2,
|
||||
'New York': 1,
|
||||
'Unknown': 2,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user