mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
add failing test case
This commit is contained in:
@@ -5,6 +5,9 @@ describe('iD.validations.mismatched_geometry', function () {
|
||||
_savedAreaKeys = iD.osmAreaKeys;
|
||||
context = iD.coreContext().init();
|
||||
iD.fileFetcher.cache().preset_presets = {
|
||||
'Line': { geometry: ['line'], fallback: true, tags: {} },
|
||||
'Area': { geometry: ['area'], fallback: true, tags: { area: 'yes' } },
|
||||
'Building': { geometry: ['area'], tags: { building: '*' } },
|
||||
library: {
|
||||
tags: { amenity: 'library' },
|
||||
geometry: ['point', 'vertex', 'line', 'area'],
|
||||
@@ -98,7 +101,8 @@ describe('iD.validations.mismatched_geometry', function () {
|
||||
expect(issues).to.have.lengthOf(0);
|
||||
});
|
||||
|
||||
it('flags open way with area tag', function() {
|
||||
it('flags open way with area tag', async () => {
|
||||
await iD.presetManager.ensureLoaded(true);
|
||||
iD.osmSetAreaKeys({ building: {} });
|
||||
createOpenWay({ building: 'yes' });
|
||||
var issues = validate();
|
||||
@@ -123,6 +127,18 @@ describe('iD.validations.mismatched_geometry', function () {
|
||||
expect(issue.entityIds[0]).to.eql('w-1');
|
||||
});
|
||||
|
||||
it('does not flag cases whether the entity matches the generic preset, regardless of geometry', async () => {
|
||||
// in this test case, waterway=dam is allowed as an area,
|
||||
// and there is no preset for waterway=security_lock, so it
|
||||
// uses to the fallback preset for all geometries.
|
||||
await iD.presetManager.ensureLoaded(true);
|
||||
iD.osmSetAreaKeys({ waterway: { dam: true } });
|
||||
|
||||
createOpenWay({ 'disused:waterway': 'security_lock' });
|
||||
const issues = validate();
|
||||
expect(issues).to.have.lengthOf(0);
|
||||
});
|
||||
|
||||
it('does not error if the best preset is limited to certain regions', async () => {
|
||||
await iD.presetManager.ensureLoaded(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user