Fix saving typed weather locations
This commit is contained in:
@@ -20,6 +20,14 @@ assertDeepEqual(weather.parseLocationFile('{"name": "Malibu", "latitude": 34.025
|
||||
assertDeepEqual(weather.parseLocationFile('not json'), { name: '', latitude: null, longitude: null }, 'weather treats an unparseable weather.json as auto-detect')
|
||||
assertDeepEqual(weather.parseLocationFile(''), { name: '', latitude: null, longitude: null }, 'weather treats a missing weather.json as auto-detect')
|
||||
|
||||
assertDeepEqual(weather.locationCommit(' Pasadena ', [], 0), { name: 'Pasadena', latitude: null, longitude: null }, 'weather commits typed locations before suggestions load')
|
||||
assertDeepEqual(weather.locationCommit('', [], 0), { name: '', latitude: null, longitude: null }, 'weather commits an empty location as auto-detect')
|
||||
assertDeepEqual(
|
||||
weather.locationCommit('mal', [{ name: 'Malibu', latitude: 34.02577, longitude: -118.7804 }], 0),
|
||||
{ name: 'Malibu', latitude: 34.02577, longitude: -118.7804 },
|
||||
'weather commits the selected geocoding suggestion when available'
|
||||
)
|
||||
|
||||
assertEqual(weather.wttrLocationQuery('Malibu', 34.02577, -118.7804), '34.02577,-118.7804', 'weather prefers coordinates for the wttr query')
|
||||
assertEqual(weather.wttrLocationQuery('Malibu', '34.02577', '-118.7804'), '34.02577,-118.7804', 'weather accepts string coordinates')
|
||||
assertEqual(weather.wttrLocationQuery('New York', null, null), 'New%20York', 'weather URL-encodes a name-only location')
|
||||
|
||||
Reference in New Issue
Block a user