Skip to content

Commit

Permalink
tests: add tests for URIS.parseAsGeoURI()
Browse files Browse the repository at this point in the history
  • Loading branch information
andyholmes committed Apr 7, 2024
1 parent f84aea4 commit 4ab8251
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/urisTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ function parseAsCoordinateURLTest() {
URIS.parseAsCoordinateURL('https://www.openstreetmap.org/#map=16/59.3083/18.0183'));
}

function parseAsGeoURITest() {
_assertArrayEquals(['geo:37.88181,-122.18740'],
URIS.parseAsGeoURI('geo://37.88181,-122.18740'));
_assertArrayEquals(['geo:37.88181,-122.18740'],
URIS.parseAsGeoURI('geo://37.88181,-122.18740'));
_assertArrayEquals(['geo:37.88181,-122.18740', 18],
URIS.parseAsGeoURI('geo:37.88181,-122.18740?z=18'));
JsUnit.assertRaises('Propagates errors for malformed URIs',
() => URIS.parseAsGeoURI('not_a_valid_uri'));
}

function parseMapsURITest() {
JsUnit.assertEquals('Query', URIS.parseMapsURI('maps:q=Query'));
JsUnit.assertEquals('Search query', URIS.parseMapsURI('maps:q=Search%20query'));
Expand All @@ -79,5 +90,6 @@ function _assertArrayEquals(arr1, arr2) {

parseAsObjectURLTest();
parseAsCoordinateURLTest();
parseAsGeoURITest();
parseMapsURITest();

0 comments on commit 4ab8251

Please sign in to comment.