Skip to content

test: add coverage for PR #385 (nominatim endpoint & geocoder)#443

Merged
DennisOSRM merged 6 commits intogh-pagesfrom
add-tests-pr-385
May 3, 2026
Merged

test: add coverage for PR #385 (nominatim endpoint & geocoder)#443
DennisOSRM merged 6 commits intogh-pagesfrom
add-tests-pr-385

Conversation

@DennisOSRM
Copy link
Copy Markdown
Contributor

Adds unit tests for NOMINATIM_ENDPOINT replacement and geocoder.coordPreserving serviceUrl/coordinate preservation.

nhirokinet and others added 5 commits April 3, 2026 11:16
Most of API endpoints can be modified via leaflet_options.js, which is
mentioned in README as a target of manual modify.

But nominatim endpoint cannot be modified by this way. As nominatim can
be self-hosted, I think it should be modifiable in configuration.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…eserving)

Adds unit tests for scripts/replace.applyReplacements (NOMINATIM_ENDPOINT) and src/geocoder.coordPreserving serviceUrl/coordinate preservation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 3, 2026 13:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Jest coverage and wiring to allow overriding the Nominatim endpoint via NOMINATIM_ENDPOINT, and ensures coordPreserving passes a configurable Nominatim serviceUrl while preserving typed coordinate centers.

Changes:

  • Added unit tests for applyReplacements Nominatim URL replacement and geocoder.coordPreserving serviceUrl + coordinate preservation behavior.
  • Added leafletOptions.nominatim.path default and threaded it into createGeocoder.coordPreserving(...).
  • Updated geocoder.coordPreserving to accept a Nominatim URL and pass it to L.Control.Geocoder.nominatim.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/replace_nominatim.test.js Adds tests for NOMINATIM endpoint replacement behavior.
test/geocoder.test.js Adds tests for coord input preservation and serviceUrl being passed.
src/leaflet_options.js Introduces a default Nominatim endpoint in options.
src/index.js Passes configured Nominatim endpoint into coordPreserving.
src/geocoder.js Adds a nominatimUrl parameter and forwards it to Leaflet-Control-Geocoder.
scripts/replace.js Adds NOMINATIM_ENDPOINT replacement support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/geocoder.js
geocoder.coordPreserving = function() {
var nominatim = L.Control.Geocoder.nominatim();
geocoder.coordPreserving = function(nominatimUrl) {
var nominatim = L.Control.Geocoder.nominatim({serviceUrl: nominatimUrl});
Comment thread scripts/replace.js
// Leaflet uses LatLng
else options = options.replace('38.8995,-77.0269', latlng)
}
if (NOMINATIM_ENDPOINT) options = options.replace('https://nominatim.openstreetmap.org/', NOMINATIM_ENDPOINT)
Comment thread test/geocoder.test.js
Comment on lines +23 to +24
const g = geocoder.coordPreserving('https://nominatim.example/');
expect(L.Control.Geocoder.nominatim).toHaveBeenCalledWith({ serviceUrl: 'https://nominatim.example/' });
@DennisOSRM DennisOSRM merged commit 86c99aa into gh-pages May 3, 2026
5 checks passed
@DennisOSRM DennisOSRM deleted the add-tests-pr-385 branch May 3, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants