-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: better inference for Geocoder type
- Loading branch information
1 parent
e0d1095
commit c994e40
Showing
4 changed files
with
56 additions
and
23 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,48 @@ | ||
import UniversalGeocoder, { GeocoderName } from "UniversalGeocoder"; | ||
|
||
describe("Universal Geocoder main module", () => { | ||
it("can geocode with a specified geocoder", (done) => { | ||
const useGeocoder = () => | ||
UniversalGeocoder.createGeocoder({ | ||
provider: "nominatim", | ||
useSsl: true, | ||
userAgent: "Universal Geocoder Example", | ||
}); | ||
const geocoder = useGeocoder(); | ||
expect(geocoder).toBeDefined(); | ||
geocoder.geocode("1600 Pennsylvania Ave, Washington, DC", (results) => { | ||
expect(results).toBeDefined(); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("can geocode with an unspecified geocoder", (done) => { | ||
const useGeocoder = (geocoderName: string) => | ||
UniversalGeocoder.createGeocoder({ | ||
provider: geocoderName, | ||
useSsl: true, | ||
userAgent: "Universal Geocoder Example", | ||
}); | ||
const geocoder = useGeocoder("nominatim"); | ||
expect(geocoder).toBeDefined(); | ||
geocoder?.geocode("1600 Pennsylvania Ave, Washington, DC", (results) => { | ||
expect(results).toBeDefined(); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("can geocode with a restricted unspecified geocoder", (done) => { | ||
const useGeocoder = (geocoderName: GeocoderName) => | ||
UniversalGeocoder.createGeocoder({ | ||
provider: geocoderName, | ||
useSsl: true, | ||
userAgent: "Universal Geocoder Example", | ||
}); | ||
const geocoder = useGeocoder("nominatim"); | ||
expect(geocoder).toBeDefined(); | ||
geocoder.geocode("1600 Pennsylvania Ave, Washington, DC", (results) => { | ||
expect(results).toBeDefined(); | ||
done(); | ||
}); | ||
}); | ||
}); |
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
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