@@ -181,6 +181,26 @@ describe('openSenseMap API Routes: /boxes', function () {
181
181
} ) ;
182
182
} ) ;
183
183
184
+ it ( 'should return a box as geojson' , function ( ) {
185
+ return chakram . get ( `${ BASE_URL } /boxes/${ boxId } ?format=geojson` )
186
+ . then ( function ( response ) {
187
+ expect ( response ) . to . have . status ( 200 ) ;
188
+ const geojsonBox = response . body ;
189
+ expect ( geojsonBox ) . an ( 'object' ) ;
190
+ expect ( geojsonBox . type ) . equal ( 'Feature' ) ;
191
+ expect ( geojsonBox . geometry ) . an ( 'object' ) ;
192
+
193
+ expect ( geojsonBox . geometry . coordinates ) . an ( 'array' ) ;
194
+ for ( const coord of geojsonBox . geometry . coordinates ) {
195
+ expect ( coord ) . a ( 'number' ) ;
196
+ }
197
+ expect ( Math . abs ( geojsonBox . geometry . coordinates [ 0 ] ) ) . most ( 180 ) ;
198
+ expect ( Math . abs ( geojsonBox . geometry . coordinates [ 1 ] ) ) . most ( 90 ) ;
199
+
200
+ return chakram . wait ( ) ;
201
+ } ) ;
202
+ } ) ;
203
+
184
204
it ( 'should let users retrieve their arduino sketch' , function ( ) {
185
205
return chakram . get ( `${ BASE_URL } /boxes/${ boxId } /script` , { headers : { 'Authorization' : `Bearer ${ jwt } ` } } )
186
206
. then ( function ( response ) {
@@ -423,7 +443,8 @@ describe('openSenseMap API Routes: /boxes', function () {
423
443
expect ( response ) . to . comprise . of . json ( 'data.exposure' , update_payload . exposure ) ;
424
444
expect ( response ) . to . comprise . of . json ( 'data.grouptag' , update_payload . grouptag ) ;
425
445
expect ( response ) . to . comprise . of . json ( 'data.description' , update_payload . description ) ;
426
- expect ( response ) . to . comprise . of . json ( 'data.currentLocation' , { type : 'Point' ,
446
+ expect ( response ) . to . comprise . of . json ( 'data.currentLocation' , {
447
+ type : 'Point' ,
427
448
coordinates : [ update_payload . location . lng , update_payload . location . lat ]
428
449
} ) ;
429
450
0 commit comments