Files
marco/tests/unit/utils/osm-icons-test.js
Râu Cao 818ec35071 Ensure map marker clicks preserve search context
Fixes the back button just closing the sidebar and clearing the whole
search after having seleted a result via map marker
2026-03-23 16:42:32 +04:00

40 lines
1.5 KiB
JavaScript

import { getIconNameForTags } from 'marco/utils/osm-icons';
import { module, test } from 'qunit';
module('Unit | Utility | osm-icons', function () {
test('it returns molar-tooth for amenity=dentist', function (assert) {
let result = getIconNameForTags({ amenity: 'dentist' });
assert.strictEqual(result, 'molar-tooth');
});
test('it returns molar-tooth for healthcare=dentist', function (assert) {
let result = getIconNameForTags({ healthcare: 'dentist' });
assert.strictEqual(result, 'molar-tooth');
});
test('it returns greek-cross for healthcare=hospital (catch-all)', function (assert) {
let result = getIconNameForTags({ healthcare: 'hospital' });
assert.strictEqual(result, 'greek-cross');
});
test('it returns greek-cross for healthcare=yes (catch-all)', function (assert) {
let result = getIconNameForTags({ healthcare: 'yes' });
assert.strictEqual(result, 'greek-cross');
});
test('it returns shopping-basket for known shop types like convenience', function (assert) {
let result = getIconNameForTags({ shop: 'convenience' });
assert.strictEqual(result, 'shopping-basket');
});
test('it returns shopping-bag for unknown shop types (catch-all)', function (assert) {
let result = getIconNameForTags({ shop: 'unknown_shop_type' });
assert.strictEqual(result, 'shopping-bag');
});
test('it returns null for unknown tags', function (assert) {
let result = getIconNameForTags({ foo: 'bar' });
assert.strictEqual(result, null);
});
});