X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/b2d1e2a271b3f2157987908bb284be14732a747b..f111fc34b87b177358c82e48d1829a5db70c4d13:/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({}), '');