mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +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,
|
||||
...parseUserAgent(userAgent),
|
||||
referer: extractDomain(referer),
|
||||
country: visitLocation?.countryName ?? 'Unknown',
|
||||
city: visitLocation?.cityName ?? 'Unknown',
|
||||
country: visitLocation?.countryName || 'Unknown', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
|
||||
city: visitLocation?.cityName || 'Unknown', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
|
||||
latitude: visitLocation?.latitude,
|
||||
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',
|
||||
visitLocation: {
|
||||
countryName: 'Spain',
|
||||
cityName: '',
|
||||
},
|
||||
}),
|
||||
Mock.of<Visit>({
|
||||
|
|
Loading…
Reference in a new issue