Skip to content

Commit 8b75e4a

Browse files
authored
Update building.test.js
1 parent bb7ef01 commit 8b75e4a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/building.test.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ test('Test downloading type=building with multipolygon outline and multiple inne
315315
expect(global.fetch.mock.calls[2][0]).toBe(urlBase + 'map?bbox=30.4980057,59.9380365,30.4993839,59.9385087');
316316
});
317317

318-
test('Part must be within outline', () => {
319-
const data = `<?xml version="1.0" encoding="UTF-8"?>
318+
const nonIntersectingWays = `<?xml version="1.0" encoding="UTF-8"?>
320319
<osm>
321320
<node id="1" lat="0.001" lon="0.001"/>
322321
<node id="2" lat="0.001" lon="0"/>
@@ -342,11 +341,8 @@ test('Part must be within outline', () => {
342341
</way>
343342
</osm>
344343
`;
345-
expect(new Building('11', data).parts.length).toBe(0);
346-
});
347344

348-
test('Multipolygon Part must be within outline', () => {
349-
const data = `<?xml version="1.0" encoding="UTF-8"?>
345+
const nonIntersectingWayAndMulti = `<?xml version="1.0" encoding="UTF-8"?>
350346
<osm>
351347
<node id="1" lat="0.001" lon="0.001"/>
352348
<node id="2" lat="0.001" lon="0"/>
@@ -375,7 +371,14 @@ test('Multipolygon Part must be within outline', () => {
375371
</relation>
376372
</osm>
377373
`;
378-
expect(new Building('11', data).parts.length).toBe(0);
374+
375+
describe.each([
376+
[nonIntersectingWays, 0, 'ways non-intersecting'],
377+
[nonIntersectingWayAndMulti, 0, 'multipolygon non-intersecting'],
378+
])('Part must be within outline', (data, expected, description) => {
379+
test(`${description}`, () => {
380+
expect(new Building('11', data).parts.length).toBe(expected);
381+
});
379382
});
380383

381384
/** Test partIsInside

0 commit comments

Comments
 (0)