-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathofnBe.test.js
174 lines (170 loc) · 4.3 KB
/
ofnBe.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import { Geocoder, ofnBeProfile, nominatimGetDetails } from "../geocoder.js";
test("Geocode OFN address - sample", async () => {
const geocoder = new Geocoder(ofnBeProfile);
const result = await geocoder.locate(runs.exactMatchInCountryside.input);
const nominatimSearch = await nominatimGetDetails({
namedetails: 1,
extratags: 1,
osmtype: result.electedOsmElement.type,
osmid: result.electedOsmElement.id,
addressdetails: 1,
});
console.log(JSON.stringify(result, null, 2));
console.log(JSON.stringify(nominatimSearch, null, 2));
//expect(1+2).toBe(3);
});
const runs = {
exactMatchInCity: {
input: {
address1: "Av. du Vert Chasseur 46",
address2: null, // TODO use later, not sure it is in use
country_id: 29,
country_name: "Belgium",
zipcode: "1180",
city: "Uccle",
state_name: "RBC",
state_id: 213,
},
output: {
electedMatch: {
countrycode: "BE",
state: "Région de Bruxelles-Capitale - Brussels Hoofdstedelijk Gewest",
county: "Brussel-Hoofdstad - Bruxelles-Capitale",
city: "Uccle - Ukkel",
postcode: "1180",
street: "Avenue du Vert Chasseur - Groene Jagerslaan",
housenumber: "46",
},
electedOsmElement: {
id: "30355110",
type: "W",
},
},
},
houseNumberUnknown: {
input: {
address1: "Grand rue 60A",
address2: null, // TODO use later, not sure it is in use
country_id: 29,
country_name: "Belgium",
zipcode: "6850",
city: "Carlsbourg",
state_name: "Luxembourg",
state_id: 213,
},
output: {
electedMatch: {
countrycode: "BE",
state: "Luxembourg",
county: "Neufchâteau",
city: "Paliseul",
district: "Carlsbourg",
postcode: "6850",
street: "Grand Rue",
},
electedOsmElement: {
id: "617274322",
type: "W",
},
},
},
exactMatchInCountryside: {
input: {
address1: "Grand rue 40",
address2: null, // TODO use later, not sure it is in use
country_id: 29,
country_name: "Belgium",
zipcode: "6850",
city: "Carlsbourg",
state_name: "Luxembourg",
state_id: 213,
},
output: {
electedMatch: {
countrycode: "BE",
state: "Luxembourg",
county: "Neufchâteau",
city: "Paliseul",
district: "Carlsbourg",
postcode: "6850",
street: "Grand Rue",
housenumber: "40",
},
electedOsmElement: {
id: "890827177",
type: "W",
},
},
},
notTheExactCity: {
input: {
address1: "Avenue Franklin Roosevelt 50",
address2: null,
country_id: 29,
country_name: "Belgium",
zipcode: "1050",
city: "Ixelles",
},
ouput: {
electedMatch: {
countrycode: "BE",
state: "Région de Bruxelles-Capitale - Brussels Hoofdstedelijk Gewest",
county: "Brussel-Hoofdstad - Bruxelles-Capitale",
city: "Bruxelles - Brussel",
district: "Bruxelles - Brussel",
postcode: "1000",
street: "Avenue Franklin Roosevelt - Franklin Rooseveltlaan",
housenumber: "50",
},
electedOsmElement: {
id: "9429754917",
type: "N",
},
},
},
fakeStreet: {
input: {
address1: "Av. des bons légumes",
address2: null,
country_id: 29,
country_name: "Belgium",
zipcode: "1050",
city: "Ixelles",
},
output: {
electedMatch: {
countrycode: "BE",
state: "Région de Bruxelles-Capitale - Brussels Hoofdstedelijk Gewest",
county: "Brussel-Hoofdstad - Bruxelles-Capitale",
city: "Ixelles - Elsene",
},
electedOsmElement: {
id: "58250",
type: "R",
},
},
},
inAnotherCountryWithoutAStreet: {
input: {
address1: "Swainstown",
address2: null,
country_name: "Ireland",
zipcode: "C15 YK80",
city: "Kilmessan",
},
output: {
electedMatch: {
countrycode: "IE",
county: "County Meath",
city: "Kilmessan",
district: "Kilmessan ED",
postcode: "C15 YK80",
street: "Swainstown",
},
electedOsmElement: {
id: "10026781976",
type: "N",
},
},
},
};