Files
marco/tests/unit/components/map-test.js
T
raucao 0d92fc9937
CI / Lint (pull_request) Successful in 1m5s
CI / Test (pull_request) Successful in 1m20s
Release Drafter / Update release notes draft (pull_request) Successful in 5s
Fix lint errors
2026-09-03 14:21:22 -06:00

67 lines
1.5 KiB
JavaScript

import MapComponent from 'marco/components/map';
import { module, test } from 'qunit';
module('Unit | Component | map', function () {
test('it decodes Planetiler vector tile POI ids into OSM ids and types', function (assert) {
const feature = {
get(key) {
if (key === 'mvt:layer') return 'poi';
return undefined;
},
getId() {
return 12342;
},
};
const result = MapComponent.prototype.decodeVectorTileOsmFeature(feature);
assert.deepEqual(result, {
decoded: {
osmId: '1234',
osmType: 'way',
},
reason: null,
});
});
test('it ignores non-POI vector tile features', function (assert) {
const feature = {
get(key) {
if (key === 'mvt:layer') return 'transportation';
return undefined;
},
getId() {
return 12342;
},
};
assert.deepEqual(
MapComponent.prototype.decodeVectorTileOsmFeature(feature),
{
decoded: null,
reason: 'unsupported source layer: transportation',
}
);
});
test('it ignores unsupported or invalid vector tile ids', function (assert) {
const feature = {
get(key) {
if (key === 'mvt:layer') return 'poi';
return undefined;
},
getId() {
return 12340;
},
};
assert.deepEqual(
MapComponent.prototype.decodeVectorTileOsmFeature(feature),
{
decoded: null,
reason: 'feature id suffix 0 is not an OSM type',
}
);
});
});