mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Fixed visits normalization not converting empty strings into null
This commit is contained in:
parent
2951d0d75e
commit
23046c149c
2 changed files with 3 additions and 2 deletions
|
@ -72,8 +72,8 @@ export const normalizeVisits = map(({ userAgent, date, referer, visitLocation }:
|
||||||
date,
|
date,
|
||||||
...parseUserAgent(userAgent),
|
...parseUserAgent(userAgent),
|
||||||
referer: extractDomain(referer),
|
referer: extractDomain(referer),
|
||||||
country: visitLocation?.countryName ?? 'Unknown',
|
country: visitLocation?.countryName || 'Unknown', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
city: visitLocation?.cityName ?? 'Unknown',
|
city: visitLocation?.cityName || 'Unknown', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
latitude: visitLocation?.latitude,
|
latitude: visitLocation?.latitude,
|
||||||
longitude: visitLocation?.longitude,
|
longitude: visitLocation?.longitude,
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -28,6 +28,7 @@ describe('VisitsParser', () => {
|
||||||
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',
|
||||||
visitLocation: {
|
visitLocation: {
|
||||||
countryName: 'Spain',
|
countryName: 'Spain',
|
||||||
|
cityName: '',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
Mock.of<Visit>({
|
Mock.of<Visit>({
|
||||||
|
|
Loading…
Reference in a new issue