-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
5,914 additions
and
2,882 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"preset": "ts-jest" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`L.Control.Geocoder.Nominatim geocodes Innsbruck 1`] = ` | ||
Array [ | ||
Array [ | ||
Array [ | ||
Object { | ||
"bbox": Object { | ||
"_northEast": Object { | ||
"lat": 47.2808566, | ||
"lng": 11.418183, | ||
}, | ||
"_southWest": Object { | ||
"lat": 47.2583715, | ||
"lng": 11.3811871, | ||
}, | ||
}, | ||
"center": Object { | ||
"lat": 47.26951525, | ||
"lng": 11.3971372042211, | ||
}, | ||
"html": "<span class=\\"\\"> Innsbruck </span><br/><span class=\\"leaflet-control-geocoder-address-context\\">Tyrol Austria</span>", | ||
"icon": "https://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png", | ||
"name": "Innsbruck, Tyrol, Austria", | ||
"properties": Object { | ||
"address": Object { | ||
"city": "Innsbruck", | ||
"city_district": "Innsbruck", | ||
"country": "Austria", | ||
"country_code": "at", | ||
"county": "Innsbruck", | ||
"state": "Tyrol", | ||
}, | ||
"boundingbox": Array [ | ||
47.2583715, | ||
47.2808566, | ||
11.3811871, | ||
11.418183, | ||
], | ||
"class": "boundary", | ||
"display_name": "Innsbruck, Tyrol, Austria", | ||
"icon": "https://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png", | ||
"importance": 0.763909048330467, | ||
"lat": "47.26951525", | ||
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", | ||
"lon": "11.3971372042211", | ||
"osm_id": 8182617, | ||
"osm_type": "relation", | ||
"place_id": 199282228, | ||
"type": "administrative", | ||
}, | ||
}, | ||
], | ||
], | ||
] | ||
`; | ||
|
||
exports[`L.Control.Geocoder.Nominatim reverse geocodes 47.3/11.3 1`] = ` | ||
Array [ | ||
Array [ | ||
Array [ | ||
Object { | ||
"bounds": Object { | ||
"_northEast": Object { | ||
"lat": 47.2065094, | ||
"lng": 11.3836945900354, | ||
}, | ||
"_southWest": Object { | ||
"lat": 47.2065094, | ||
"lng": 11.3836945900354, | ||
}, | ||
}, | ||
"center": Object { | ||
"lat": 47.2065094, | ||
"lng": 11.3836945900354, | ||
}, | ||
"html": "<span class=\\"\\">Tyrol Austria</span>", | ||
"name": "Innsbruck-Land, Tyrol, Austria", | ||
"properties": Object { | ||
"address": Object { | ||
"country": "Austria", | ||
"country_code": "at", | ||
"county": "Innsbruck-Land", | ||
"state": "Tyrol", | ||
}, | ||
"boundingbox": Array [ | ||
"46.9624854", | ||
"47.4499229", | ||
"10.9896868", | ||
"11.7051742", | ||
], | ||
"display_name": "Innsbruck-Land, Tyrol, Austria", | ||
"lat": "47.2065094", | ||
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", | ||
"lon": "11.3836945900354", | ||
"osm_id": 78251, | ||
"osm_type": "relation", | ||
"place_id": 197718025, | ||
}, | ||
}, | ||
], | ||
], | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`L.Control.Geocoder.Openrouteservice geocodes Innsbruck 1`] = ` | ||
Array [ | ||
Array [ | ||
Array [ | ||
Object { | ||
"bbox": Object { | ||
"_northEast": Object { | ||
"lat": 47.29398, | ||
"lng": 11.452584553, | ||
}, | ||
"_southWest": Object { | ||
"lat": 47.2470573997, | ||
"lng": 11.3218091258, | ||
}, | ||
}, | ||
"center": Object { | ||
"lat": 47.272308, | ||
"lng": 11.407851, | ||
}, | ||
"name": "Innsbruck, Austria", | ||
"properties": Object { | ||
"accuracy": "centroid", | ||
"confidence": 1, | ||
"continent": "Europe", | ||
"country": "Austria", | ||
"country_a": "AUT", | ||
"county": "Innsbruck", | ||
"county_a": "IN", | ||
"id": "101748061", | ||
"label": "Innsbruck, Austria", | ||
"layer": "locality", | ||
"localadmin": "Innsbruck", | ||
"locality": "Innsbruck", | ||
"match_type": "exact", | ||
"name": "Innsbruck", | ||
"region": "Tirol", | ||
"region_a": "TR", | ||
"source_id": "101748061", | ||
}, | ||
}, | ||
], | ||
], | ||
] | ||
`; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export function mockXMLHttpRequest<T>(response: T): XMLHttpRequest { | ||
const xhrMock: Partial<XMLHttpRequest> = { | ||
open: jest.fn(), | ||
send: jest.fn(), | ||
setRequestHeader: jest.fn(), | ||
readyState: 4, | ||
status: 200, | ||
response | ||
}; | ||
jest.spyOn(window, 'XMLHttpRequest').mockImplementation(() => xhrMock as XMLHttpRequest); | ||
return xhrMock as XMLHttpRequest; | ||
} | ||
|
||
export function testXMLHttpRequest<T>(url: string, response: T, trigger: () => void) { | ||
const xhrMock = mockXMLHttpRequest(response); | ||
trigger(); | ||
expect(xhrMock.open).toBeCalledWith('GET', url, true); | ||
expect(xhrMock.setRequestHeader).toBeCalledWith('Accept', 'application/json'); | ||
(xhrMock.onreadystatechange as EventListener)(new Event('')); | ||
} |
Oops, something went wrong.