X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/d1075b7512f5004614ac98c174f2ba699cb510b9..b2d1e2a271b3f2157987908bb284be14732a747b:/test/unit/helpers.js diff --git a/test/unit/helpers.js b/test/unit/helpers.js index 9570059..cea1512 100644 --- a/test/unit/helpers.js +++ b/test/unit/helpers.js @@ -1,36 +1,36 @@ -const assert = require('assert'); -const helpers = require('../../src/lib/helpers'); +import assert from 'assert'; +import { formatLabel, wikipediaLink } from '../../src/lib/helpers.js'; describe('Helpers', function () { it('.formatLabel', function () { // not enough data - assert.equal(helpers.formatLabel({}), ''); + assert.equal(formatLabel({}), ''); // if label set, that becomes the label - assert.equal(helpers.formatLabel({ label: 'A Label' }), 'A Label'); + assert.equal(formatLabel({ label: 'A Label' }), 'A Label'); // type, but nicely formatted - assert.equal(helpers.formatLabel({ category: 'highway', type: 'bus_stop' }), 'Bus stop'); + assert.equal(formatLabel({ category: 'highway', type: 'bus_stop' }), 'Bus stop'); // type=yes, so we use the category - assert.equal(helpers.formatLabel({ category: 'building', type: 'yes' }), 'Building'); + assert.equal(formatLabel({ category: 'building', type: 'yes' }), 'Building'); }); it('.wikipediaLink', function () { assert.equal( - helpers.wikipediaLink({}), + wikipediaLink({}), '' ); assert.equal( - helpers.wikipediaLink({ calculated_wikipedia: 'de:Brandenburg Gate' }), + wikipediaLink({ calculated_wikipedia: 'de:Brandenburg Gate' }), 'de:Brandenburg Gate' ); // title includes HTML assert.equal( - helpers.wikipediaLink({ calculated_wikipedia: 'en:Slug & Lattuce' }), + wikipediaLink({ calculated_wikipedia: 'en:Slug & Lattuce' }), 'en:Slug & Lattuce' ); });