Skip to content

Commit 56f53e8

Browse files
authored
Implement shapes for airport perimeter, terminal and coordinates for gates (#125)
* Implement shapes for airport, terminal and coordinates for gates * Implement shapes for airport perimeter, terminal and coordinates for gates
1 parent 0fd384e commit 56f53e8

61 files changed

Lines changed: 1926 additions & 436 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

features/_helper/deep-compare.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import expect from 'expect';
22
import { validate as isUuid } from 'uuid';
33

44
export const deepCompare = (actual: any, expected: any) => {
5+
if (expected === '@any') {
6+
return;
7+
}
8+
59
if (expected === '@uuid') {
610
expect(isUuid(actual)).toBe(true);
711
return;

features/airport/airport.create.feature

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Feature: Create airport
2828
}
2929
"""
3030

31-
Scenario: As operations I can create airport
31+
Scenario: As operations I can create airport with boundary shape
3232
Given I am signed in as "operations"
3333
When I send a "POST" request to "/api/v1/airport" with body:
3434
"""json
@@ -43,7 +43,13 @@ Feature: Create airport
4343
"latitude": 25.7933,
4444
"longitude": -80.2906
4545
},
46-
"continent": "north_america"
46+
"continent": "north_america",
47+
"shape": [
48+
{ "latitude": 25.7933, "longitude": -80.2906 },
49+
{ "latitude": 25.8033, "longitude": -80.2906 },
50+
{ "latitude": 25.8033, "longitude": -80.2806 },
51+
{ "latitude": 25.7933, "longitude": -80.2806 }
52+
]
4753
}
4854
"""
4955
Then the response status should be 201
@@ -61,11 +67,52 @@ Feature: Create airport
6167
"latitude": 25.7933,
6268
"longitude": -80.2906
6369
},
64-
"continent": "north_america"
70+
"continent": "north_america",
71+
"shape": [
72+
{ "latitude": 25.7933, "longitude": -80.2906 },
73+
{ "latitude": 25.8033, "longitude": -80.2906 },
74+
{ "latitude": 25.8033, "longitude": -80.2806 },
75+
{ "latitude": 25.7933, "longitude": -80.2806 }
76+
]
6577
}
6678
"""
6779
And I set database to initial state
6880

81+
Scenario: As operations I cannot create airport with a degenerate shape
82+
Given I am signed in as "operations"
83+
When I send a "POST" request to "/api/v1/airport" with body:
84+
"""json
85+
{
86+
"icaoCode": "KMIA",
87+
"name": "Miami Intl",
88+
"iataCode": "MIA",
89+
"city": "Miami",
90+
"country": "United States of America",
91+
"timezone": "America/New_York",
92+
"location": {
93+
"latitude": 25.7933,
94+
"longitude": -80.2906
95+
},
96+
"continent": "north_america",
97+
"shape": [
98+
{ "latitude": 25.7933, "longitude": -80.2906 },
99+
{ "latitude": 25.8033, "longitude": -80.2906 }
100+
]
101+
}
102+
"""
103+
Then the response status should be 400
104+
And the response body should contain:
105+
"""json
106+
{
107+
"message": "Request validation failed.",
108+
"error": "Bad Request",
109+
"statusCode": 400,
110+
"violations": {
111+
"shape": ["shape must contain at least 3 elements"]
112+
}
113+
}
114+
"""
115+
69116
Scenario: As a cabin crew I cannot create airport
70117
Given I am signed in as "cabin crew"
71118
When I send a "POST" request to "/api/v1/airport" with body:

features/airport/airport.get.feature

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ Feature: Get airport
1818
"location": {
1919
"longitude": 8.57397,
2020
"latitude": 50.04693
21-
}
21+
},
22+
"shape": [
23+
{ "latitude": 50.03693, "longitude": 8.56397 },
24+
{ "latitude": 50.03693, "longitude": 8.58397 },
25+
{ "latitude": 50.05693, "longitude": 8.58397 },
26+
{ "latitude": 50.05693, "longitude": 8.56397 }
27+
]
2228
}
2329
"""
2430

@@ -40,7 +46,13 @@ Feature: Get airport
4046
"location": {
4147
"longitude": 8.57397,
4248
"latitude": 50.04693
43-
}
49+
},
50+
"shape": [
51+
{ "latitude": 50.03693, "longitude": 8.56397 },
52+
{ "latitude": 50.03693, "longitude": 8.58397 },
53+
{ "latitude": 50.05693, "longitude": 8.58397 },
54+
{ "latitude": 50.05693, "longitude": 8.56397 }
55+
]
4456
}
4557
"""
4658

@@ -62,7 +74,13 @@ Feature: Get airport
6274
"location": {
6375
"longitude": 8.57397,
6476
"latitude": 50.04693
65-
}
77+
},
78+
"shape": [
79+
{ "latitude": 50.03693, "longitude": 8.56397 },
80+
{ "latitude": 50.03693, "longitude": 8.58397 },
81+
{ "latitude": 50.05693, "longitude": 8.58397 },
82+
{ "latitude": 50.05693, "longitude": 8.56397 }
83+
]
6684
}
6785
"""
6886

features/airport/airport.list.feature

Lines changed: 105 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ Feature: List airports
1919
"location": {
2020
"longitude": 8.57397,
2121
"latitude": 50.04693
22-
}
22+
},
23+
"shape": [
24+
{ "latitude": 50.03693, "longitude": 8.56397 },
25+
{ "latitude": 50.03693, "longitude": 8.58397 },
26+
{ "latitude": 50.05693, "longitude": 8.58397 },
27+
{ "latitude": 50.05693, "longitude": 8.56397 }
28+
]
2329
},
2430
{
2531
"id": "616cbdd7-ccfc-4687-8cf6-1e7236435046",
@@ -33,7 +39,13 @@ Feature: List airports
3339
"location": {
3440
"longitude": 20.967123,
3541
"latitude": 52.16575
36-
}
42+
},
43+
"shape": [
44+
{ "latitude": 52.15575, "longitude": 20.957123 },
45+
{ "latitude": 52.15575, "longitude": 20.977123 },
46+
{ "latitude": 52.17575, "longitude": 20.977123 },
47+
{ "latitude": 52.17575, "longitude": 20.957123 }
48+
]
3749
},
3850
{
3951
"id": "3c721cc6-c653-4fad-be43-dc9d6a149383",
@@ -47,7 +59,13 @@ Feature: List airports
4759
"location": {
4860
"longitude": -73.7781,
4961
"latitude": 40.6413
50-
}
62+
},
63+
"shape": [
64+
{ "latitude": 40.6313, "longitude": -73.7881 },
65+
{ "latitude": 40.6313, "longitude": -73.7681 },
66+
{ "latitude": 40.6513, "longitude": -73.7681 },
67+
{ "latitude": 40.6513, "longitude": -73.7881 }
68+
]
5169
},
5270
{
5371
"id": "79b8f884-f67d-4585-b540-36b0be7f551e",
@@ -61,7 +79,13 @@ Feature: List airports
6179
"location": {
6280
"longitude": 2.55412,
6381
"latitude": 49.00896
64-
}
82+
},
83+
"shape": [
84+
{ "latitude": 48.99896, "longitude": 2.54412 },
85+
{ "latitude": 48.99896, "longitude": 2.56412 },
86+
{ "latitude": 49.01896, "longitude": 2.56412 },
87+
{ "latitude": 49.01896, "longitude": 2.54412 }
88+
]
6589
},
6690
{
6791
"id": "fa8ee2e9-fb94-4416-9ed0-4811efd488ae",
@@ -75,7 +99,13 @@ Feature: List airports
7599
"location": {
76100
"longitude": -60.409444,
77101
"latitude": 53.319168
78-
}
102+
},
103+
"shape": [
104+
{ "latitude": 53.309168, "longitude": -60.419444 },
105+
{ "latitude": 53.309168, "longitude": -60.399444 },
106+
{ "latitude": 53.329168, "longitude": -60.399444 },
107+
{ "latitude": 53.329168, "longitude": -60.419444 }
108+
]
79109
},
80110
{
81111
"id": "523b2d2f-9b60-405a-bd5a-90eed1b58e9a",
@@ -89,7 +119,13 @@ Feature: List airports
89119
"location": {
90120
"longitude": -22.6056,
91121
"latitude": 63.985
92-
}
122+
},
123+
"shape": [
124+
{ "latitude": 63.975, "longitude": -22.6156 },
125+
{ "latitude": 63.975, "longitude": -22.5956 },
126+
{ "latitude": 63.995, "longitude": -22.5956 },
127+
{ "latitude": 63.995, "longitude": -22.6156 }
128+
]
93129
},
94130
{
95131
"id": "6cf1fcd8-d072-46b5-8132-bd885b43dd97",
@@ -103,7 +139,13 @@ Feature: List airports
103139
"location": {
104140
"longitude": -52.751945,
105141
"latitude": 47.61861
106-
}
142+
},
143+
"shape": [
144+
{ "latitude": 47.60861, "longitude": -52.761945 },
145+
{ "latitude": 47.60861, "longitude": -52.741945 },
146+
{ "latitude": 47.62861, "longitude": -52.741945 },
147+
{ "latitude": 47.62861, "longitude": -52.761945 }
148+
]
107149
},
108150
{
109151
"id": "e764251b-bb25-4e8b-8cc7-11b0397b4554",
@@ -117,7 +159,13 @@ Feature: List airports
117159
"location": {
118160
"longitude": -75.24349,
119161
"latitude": 39.87113
120-
}
162+
},
163+
"shape": [
164+
{ "latitude": 39.86113, "longitude": -75.25349 },
165+
{ "latitude": 39.86113, "longitude": -75.23349 },
166+
{ "latitude": 39.88113, "longitude": -75.23349 },
167+
{ "latitude": 39.88113, "longitude": -75.25349 }
168+
]
121169
},
122170
{
123171
"id": "c03a79fb-c5ae-46c3-95fe-f3b5dc7b85f3",
@@ -131,7 +179,13 @@ Feature: List airports
131179
"location": {
132180
"longitude": -71.01663,
133181
"latitude": 42.36454
134-
}
182+
},
183+
"shape": [
184+
{ "latitude": 42.35454, "longitude": -71.02663 },
185+
{ "latitude": 42.35454, "longitude": -71.00663 },
186+
{ "latitude": 42.37454, "longitude": -71.00663 },
187+
{ "latitude": 42.37454, "longitude": -71.02663 }
188+
]
135189
},
136190
{
137191
"id": "5c88ea21-f482-47ff-8b1f-3d0c9bbd6caf",
@@ -145,7 +199,13 @@ Feature: List airports
145199
"location": {
146200
"longitude": 8.786667,
147201
"latitude": 53.0475
148-
}
202+
},
203+
"shape": [
204+
{ "latitude": 53.0375, "longitude": 8.776667 },
205+
{ "latitude": 53.0375, "longitude": 8.796667 },
206+
{ "latitude": 53.0575, "longitude": 8.796667 },
207+
{ "latitude": 53.0575, "longitude": 8.776667 }
208+
]
149209
}
150210
]
151211
"""
@@ -179,7 +239,13 @@ Feature: List airports
179239
"location": {
180240
"longitude": 8.57397,
181241
"latitude": 50.04693
182-
}
242+
},
243+
"shape": [
244+
{ "latitude": 50.03693, "longitude": 8.56397 },
245+
{ "latitude": 50.03693, "longitude": 8.58397 },
246+
{ "latitude": 50.05693, "longitude": 8.58397 },
247+
{ "latitude": 50.05693, "longitude": 8.56397 }
248+
]
183249
},
184250
{
185251
"id": "616cbdd7-ccfc-4687-8cf6-1e7236435046",
@@ -193,7 +259,13 @@ Feature: List airports
193259
"location": {
194260
"longitude": 20.967123,
195261
"latitude": 52.16575
196-
}
262+
},
263+
"shape": [
264+
{ "latitude": 52.15575, "longitude": 20.957123 },
265+
{ "latitude": 52.15575, "longitude": 20.977123 },
266+
{ "latitude": 52.17575, "longitude": 20.977123 },
267+
{ "latitude": 52.17575, "longitude": 20.957123 }
268+
]
197269
},
198270
{
199271
"id": "79b8f884-f67d-4585-b540-36b0be7f551e",
@@ -207,7 +279,13 @@ Feature: List airports
207279
"location": {
208280
"longitude": 2.55412,
209281
"latitude": 49.00896
210-
}
282+
},
283+
"shape": [
284+
{ "latitude": 48.99896, "longitude": 2.54412 },
285+
{ "latitude": 48.99896, "longitude": 2.56412 },
286+
{ "latitude": 49.01896, "longitude": 2.56412 },
287+
{ "latitude": 49.01896, "longitude": 2.54412 }
288+
]
211289
},
212290
{
213291
"id": "523b2d2f-9b60-405a-bd5a-90eed1b58e9a",
@@ -221,7 +299,13 @@ Feature: List airports
221299
"location": {
222300
"longitude": -22.6056,
223301
"latitude": 63.985
224-
}
302+
},
303+
"shape": [
304+
{ "latitude": 63.975, "longitude": -22.6156 },
305+
{ "latitude": 63.975, "longitude": -22.5956 },
306+
{ "latitude": 63.995, "longitude": -22.5956 },
307+
{ "latitude": 63.995, "longitude": -22.6156 }
308+
]
225309
},
226310
{
227311
"id": "5c88ea21-f482-47ff-8b1f-3d0c9bbd6caf",
@@ -235,7 +319,13 @@ Feature: List airports
235319
"location": {
236320
"longitude": 8.786667,
237321
"latitude": 53.0475
238-
}
322+
},
323+
"shape": [
324+
{ "latitude": 53.0375, "longitude": 8.776667 },
325+
{ "latitude": 53.0375, "longitude": 8.796667 },
326+
{ "latitude": 53.0575, "longitude": 8.796667 },
327+
{ "latitude": 53.0575, "longitude": 8.776667 }
328+
]
239329
}
240330
]
241331
"""

features/airport/airport.update.feature

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ Feature: Update airport
4141
"location": {
4242
"longitude": 8.57397,
4343
"latitude": 50.04693
44-
}
44+
},
45+
"shape": [
46+
{ "latitude": 50.03693, "longitude": 8.56397 },
47+
{ "latitude": 50.03693, "longitude": 8.58397 },
48+
{ "latitude": 50.05693, "longitude": 8.58397 },
49+
{ "latitude": 50.05693, "longitude": 8.56397 }
50+
]
4551
}
4652
"""
4753
And I set database to initial state

0 commit comments

Comments
 (0)