Skip to content

Commit 57fc81f

Browse files
authored
Update diagnose.test.js
1 parent 84eb46a commit 57fc81f

File tree

1 file changed

+76
-71
lines changed

1 file changed

+76
-71
lines changed

test/diagnose.test.js

Lines changed: 76 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -15,86 +15,91 @@ import { Building } from '../src/building.js';
1515
import fetchMock from 'jest-fetch-mock';
1616
fetchMock.enableMocks();
1717

18+
// Step 1: get the full data for the buiding from the API
1819
const initialData = `<?xml version='1.0' encoding='UTF-8'?>
19-
<osm version="0.6" generator="openstreetmap-cgimap 2.0.1 (13 production-cgimap-deployment-6c848f5954-fwsw9)" copyright="OpenHistoricalMap is dedicated to the public domain except where otherwise noted." attribution="https://www.openhistoricalmap.org/copyright" license="https://creativecommons.org/public-domain/cc0/">
20-
<node id="2091055219" visible="true" version="5" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2578575" lon="-88.9935839"/>
21-
<node id="2091055220" visible="true" version="2" changeset="124696" timestamp="2024-06-24T14:12:44Z" user="CharliePlett" uid="1310" lat="17.2579092" lon="-88.9936201"/>
22-
<node id="2091055221" visible="true" version="4" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2580413" lon="-88.9936212"/>
23-
<node id="2091055225" visible="true" version="5" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2578904" lon="-88.9932578"/>
24-
<node id="2091055226" visible="true" version="5" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2580338" lon="-88.9932589"/>
25-
<node id="2091055229" visible="true" version="5" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2576142" lon="-88.9935169"/>
26-
<node id="2091055230" visible="true" version="5" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2576160" lon="-88.9932556"/>
27-
<node id="2091090152" visible="true" version="4" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2576687" lon="-88.9935824"/>
28-
<node id="2118297439" visible="true" version="3" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2576137" lon="-88.9935820"/>
29-
<node id="2118297440" visible="true" version="3" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2581870" lon="-88.9936225"/>
30-
<node id="2118297441" visible="true" version="3" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2581863" lon="-88.9937191"/>
31-
<node id="2118297442" visible="true" version="3" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2584306" lon="-88.9937212"/>
32-
<node id="2118297443" visible="true" version="3" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2584351" lon="-88.9931509"/>
33-
<node id="2118297444" visible="true" version="3" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2583754" lon="-88.9931504"/>
34-
<node id="2118297445" visible="true" version="3" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2583756" lon="-88.9931220"/>
35-
<node id="2118297446" visible="true" version="3" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2582611" lon="-88.9931210"/>
36-
<node id="2136764872" visible="true" version="2" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2576156" lon="-88.9933122"/>
37-
<node id="2136764874" visible="true" version="2" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2576159" lon="-88.9932694"/>
38-
<node id="2136764882" visible="true" version="2" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2584313" lon="-88.9936317"/>
39-
<node id="2136764893" visible="true" version="1" changeset="183733" timestamp="2025-07-17T03:03:42Z" user="CharliePlett" uid="1310" lat="17.2581813" lon="-88.9932416"/>
40-
<node id="2136764894" visible="true" version="1" changeset="183733" timestamp="2025-07-17T03:03:42Z" user="CharliePlett" uid="1310" lat="17.2581857" lon="-88.9932332"/>
41-
<node id="2136764895" visible="true" version="1" changeset="183733" timestamp="2025-07-17T03:03:42Z" user="CharliePlett" uid="1310" lat="17.2581881" lon="-88.9931285"/>
42-
<node id="2136764896" visible="true" version="2" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2583755" lon="-88.9931289"/>
43-
<node id="2136764905" visible="true" version="1" changeset="183733" timestamp="2025-07-17T03:03:42Z" user="CharliePlett" uid="1310" lat="17.2581826" lon="-88.9932370"/>
44-
<node id="2136764906" visible="true" version="1" changeset="183733" timestamp="2025-07-17T03:03:42Z" user="CharliePlett" uid="1310" lat="17.2581866" lon="-88.9932294"/>
45-
<node id="2136764908" visible="true" version="2" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2582610" lon="-88.9931268"/>
46-
<node id="2136764910" visible="true" version="2" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2582610" lon="-88.9931305"/>
47-
<node id="2136765022" visible="true" version="2" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2581810" lon="-88.9932601"/>
48-
<node id="2136765040" visible="true" version="1" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310" lat="17.2576138" lon="-88.9935727"/>
49-
<way id="201181659" visible="true" version="2" changeset="183738" timestamp="2025-07-17T03:14:16Z" user="CharliePlett" uid="1310">
50-
<nd ref="2091055230"/>
51-
<nd ref="2091055225"/>
52-
<nd ref="2091055226"/>
53-
<nd ref="2136765022"/>
54-
<nd ref="2136764893"/>
55-
<nd ref="2136764905"/>
56-
<nd ref="2136764894"/>
57-
<nd ref="2136764906"/>
58-
<nd ref="2136764895"/>
59-
<nd ref="2136764910"/>
60-
<nd ref="2136764908"/>
61-
<nd ref="2118297446"/>
62-
<nd ref="2118297445"/>
63-
<nd ref="2136764896"/>
64-
<nd ref="2118297444"/>
65-
<nd ref="2118297443"/>
66-
<nd ref="2136764882"/>
67-
<nd ref="2118297442"/>
68-
<nd ref="2118297441"/>
69-
<nd ref="2118297440"/>
70-
<nd ref="2091055221"/>
71-
<nd ref="2091055220"/>
72-
<nd ref="2091055219"/>
73-
<nd ref="2091090152"/>
74-
<nd ref="2118297439"/>
75-
<nd ref="2136765040"/>
76-
<nd ref="2091055229"/>
77-
<nd ref="2136764872"/>
78-
<nd ref="2136764874"/>
79-
<nd ref="2091055230"/>
80-
<tag k="building" v="industrial"/>
81-
<tag k="name" v="Country Foods"/>
82-
<tag k="start_date" v="2025"/>
83-
<tag k="wikidata" v="Q39057725"/>
84-
<tag k="wikipedia" v="en:Country Foods"/>
20+
<osm version="0.6" generator="openstreetmap-cgimap 2.0.1 (3864022 spike-08.openstreetmap.org)" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
21+
<node id="11887032796" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0271220" lon="125.7420205"/>
22+
<node id="11887032797" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0269955" lon="125.7418420"/>
23+
<node id="11887032798" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0270738" lon="125.7417502"/>
24+
<node id="11887032799" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0272002" lon="125.7419287"/>
25+
<node id="11887032818" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0271131" lon="125.7420310"/>
26+
<node id="11887032843" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0270826" lon="125.7417398"/>
27+
<node id="11887032844" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0272091" lon="125.7419183"/>
28+
<node id="11887032845" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0269867" lon="125.7418525"/>
29+
<node id="11887036731" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0272168" lon="125.7420296"/>
30+
<node id="11887036732" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0271985" lon="125.7420511"/>
31+
<node id="11887036735" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0269972" lon="125.7417197"/>
32+
<node id="11887036737" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0269789" lon="125.7417411"/>
33+
<node id="11887036739" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0271312" lon="125.7420220"/>
34+
<node id="11887036740" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0272005" lon="125.7419406"/>
35+
<node id="11887036741" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0269952" lon="125.7418302"/>
36+
<node id="11887036742" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0270646" lon="125.7417487"/>
37+
<node id="11887036753" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0270690" lon="125.7417435"/>
38+
<node id="11887036754" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0272050" lon="125.7419354"/>
39+
<node id="11887036755" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0271267" lon="125.7420272"/>
40+
<node id="11887036756" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0269908" lon="125.7418353"/>
41+
<node id="11887036757" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0269534" lon="125.7417711"/>
42+
<node id="11887036758" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0271730" lon="125.7420811"/>
43+
<node id="11887036759" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0272423" lon="125.7419996"/>
44+
<node id="11887036760" visible="true" version="1" changeset="151018259" timestamp="2024-05-07T16:11:54Z" user="Koreller" uid="12419855" lat="39.0270227" lon="125.7416897"/>
45+
<node id="11887478960" visible="true" version="1" changeset="151026777" timestamp="2024-05-07T19:54:23Z" user="Koreller" uid="12419855" lat="39.0270610" lon="125.7417436"/>
46+
<node id="11887478963" visible="true" version="1" changeset="151026777" timestamp="2024-05-07T19:54:23Z" user="Koreller" uid="12419855" lat="39.0269916" lon="125.7418251"/>
47+
<way id="398056904" visible="true" version="12" changeset="151033678" timestamp="2024-05-08T01:38:43Z" user="adreamy" uid="2750856">
48+
<nd ref="11887036742"/>
49+
<nd ref="11887478960"/>
50+
<nd ref="11887036760"/>
51+
<nd ref="11887036735"/>
52+
<nd ref="11887036737"/>
53+
<nd ref="11887036757"/>
54+
<nd ref="11887478963"/>
55+
<nd ref="11887036741"/>
56+
<nd ref="11887036756"/>
57+
<nd ref="11887032797"/>
58+
<nd ref="11887032845"/>
59+
<nd ref="11887032818"/>
60+
<nd ref="11887032796"/>
61+
<nd ref="11887036755"/>
62+
<nd ref="11887036739"/>
63+
<nd ref="11887036758"/>
64+
<nd ref="11887036732"/>
65+
<nd ref="11887036731"/>
66+
<nd ref="11887036759"/>
67+
<nd ref="11887036740"/>
68+
<nd ref="11887036754"/>
69+
<nd ref="11887032799"/>
70+
<nd ref="11887032844"/>
71+
<nd ref="11887032843"/>
72+
<nd ref="11887032798"/>
73+
<nd ref="11887036753"/>
74+
<nd ref="11887036742"/>
75+
<tag k="addr:place" v="보통문동"/>
76+
<tag k="alt_name:en" v="Potong Gate"/>
77+
<tag k="building" v="yes"/>
78+
<tag k="heritage" v="2"/>
79+
<tag k="heritage:operator" v="ccukp"/>
80+
<tag k="historic" v="city_gate"/>
81+
<tag k="historic:civilization" v="korean"/>
82+
<tag k="name" v="보통문"/>
83+
<tag k="name:en" v="Potongmun"/>
84+
<tag k="name:ko" v="보통문"/>
85+
<tag k="name:ko-Hani" v="普通門"/>
86+
<tag k="name:ru" v="Ворота Потхонмун"/>
87+
<tag k="ref:ncukp" v="3"/>
88+
<tag k="wikidata" v="Q717009"/>
89+
<tag k="wikipedia" v="ko:보통문"/>
8590
</way>
8691
</osm>
8792
`;
8893

8994
test('Diagnose Skillion Issue', async() => {
9095
fetch.mockResponses(
91-
[initialData], // /way/201181659/full
96+
[initialData], // /way/398056904/full
9297
[initialData], // /map call
9398
);
94-
const innerData = await Building.downloadDataAroundBuilding('way', '201181659');
95-
const building = new Building('201181659', innerData);
96-
expect(building.id).toBe('201181659');
99+
const innerData = await Building.downloadDataAroundBuilding('way', '398056904');
100+
const building = new Building('398056904', innerData);
101+
expect(building.id).toBe('398056904');
97102
const urlBase = 'https://api.openstreetmap.org/api/0.6/';
98-
expect(global.fetch.mock.calls[0][0]).toBe(urlBase + 'way/201181659/full');
103+
expect(global.fetch.mock.calls[0][0]).toBe(urlBase + 'way/398056904/full');
99104
expect(global.fetch.mock.calls[1][0]).toBe(urlBase + 'map?bbox=30.4980057,59.9380365,30.4993839,59.9385087');
100105
});

0 commit comments

Comments
 (0)