X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/2f8b33afce5cd34432db91fbd4d6950bd38359a3..52521128a144a4e42653e0bf8c6a6f0fddb8a6bc:/test/unit/helpers.js diff --git a/test/unit/helpers.js b/test/unit/helpers.js index cea1512..ed57c03 100644 --- a/test/unit/helpers.js +++ b/test/unit/helpers.js @@ -1,8 +1,17 @@ import assert from 'assert'; -import { formatLabel, wikipediaLink } from '../../src/lib/helpers.js'; +import { identifyLinkInQuery, formatLabel, wikipediaLink } from '../../src/lib/helpers.js'; describe('Helpers', function () { + it('.identifyLinkInQuery', function () { + assert.equal(identifyLinkInQuery(''), undefined); + assert.equal(identifyLinkInQuery('http://example.com'), undefined); + + assert.deepStrictEqual(identifyLinkInQuery('https://www.openstreetmap.org/relation/1234#map=11/41.2388/-8.3867'), ['R', 1234]); + assert.deepStrictEqual(identifyLinkInQuery('n1234'), ['N', 1234]); + assert.deepStrictEqual(identifyLinkInQuery('W1234'), ['W', 1234]); + }); + it('.formatLabel', function () { // not enough data assert.equal(formatLabel({}), '');