mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Improved VisitsParser test
This commit is contained in:
parent
db778a73f7
commit
c3e38fd580
1 changed files with 11 additions and 2 deletions
|
@ -64,7 +64,7 @@ describe('VisitsParser', () => {
|
||||||
}),
|
}),
|
||||||
Mock.of<OrphanVisit>({
|
Mock.of<OrphanVisit>({
|
||||||
type: 'invalid_short_url',
|
type: 'invalid_short_url',
|
||||||
visitedUrl: 'baz',
|
visitedUrl: 'bar',
|
||||||
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',
|
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',
|
||||||
referer: 'https://m.facebook.com',
|
referer: 'https://m.facebook.com',
|
||||||
visitLocation: {
|
visitLocation: {
|
||||||
|
@ -153,6 +153,15 @@ describe('VisitsParser', () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('properly parses visited URL stats', () => {
|
||||||
|
const { visitedUrls } = processStatsFromVisits(normalizeVisits(orphanVisits));
|
||||||
|
|
||||||
|
expect(visitedUrls).toEqual({
|
||||||
|
foo: 1,
|
||||||
|
bar: 2,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('normalizeVisits', () => {
|
describe('normalizeVisits', () => {
|
||||||
|
@ -247,7 +256,7 @@ describe('VisitsParser', () => {
|
||||||
latitude: 123.45,
|
latitude: 123.45,
|
||||||
longitude: -543.21,
|
longitude: -543.21,
|
||||||
type: 'invalid_short_url',
|
type: 'invalid_short_url',
|
||||||
visitedUrl: 'baz',
|
visitedUrl: 'bar',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue