diff --git a/test/ciao/cors.coffee b/test/ciao/CORS/headers_GET.coffee similarity index 79% rename from test/ciao/cors.coffee rename to test/ciao/CORS/headers_GET.coffee index bd97c5de..53866718 100644 --- a/test/ciao/cors.coffee +++ b/test/ciao/CORS/headers_GET.coffee @@ -4,6 +4,6 @@ path: '/' #? access control headers correctly set response.should.have.header 'Access-Control-Allow-Origin','*' -response.should.have.header 'Access-Control-Allow-Methods','GET' +response.should.have.header 'Access-Control-Allow-Methods','GET, OPTIONS' response.should.have.header 'Access-Control-Allow-Headers','X-Requested-With,content-type' response.should.have.header 'Access-Control-Allow-Credentials','true' \ No newline at end of file diff --git a/test/ciao/CORS/headers_OPTIONS.coffee b/test/ciao/CORS/headers_OPTIONS.coffee new file mode 100644 index 00000000..5575391a --- /dev/null +++ b/test/ciao/CORS/headers_OPTIONS.coffee @@ -0,0 +1,10 @@ + +#> cross-origin resource sharing +path: '/' +method: 'OPTIONS' + +#? access control headers correctly set +response.should.have.header 'Access-Control-Allow-Origin','*' +response.should.have.header 'Access-Control-Allow-Methods','GET, OPTIONS' +response.should.have.header 'Access-Control-Allow-Headers','X-Requested-With,content-type' +response.should.have.header 'Access-Control-Allow-Credentials','true' \ No newline at end of file diff --git a/test/ciao/autocomplete/basic_autocomplete.coffee b/test/ciao/autocomplete/basic_autocomplete.coffee new file mode 100644 index 00000000..dadfc9dd --- /dev/null +++ b/test/ciao/autocomplete/basic_autocomplete.coffee @@ -0,0 +1,29 @@ + +#> basic autocomplete +path: '/v1/autocomplete?text=a' + +#? 200 ok +response.statusCode.should.equal 200 +response.should.have.header 'charset', 'utf8' +response.should.have.header 'content-type', 'application/json; charset=utf-8' + +#? valid geocoding block +should.exist json.geocoding +should.exist json.geocoding.version +should.exist json.geocoding.attribution +should.exist json.geocoding.query +should.exist json.geocoding.engine +should.exist json.geocoding.engine.name +should.exist json.geocoding.engine.author +should.exist json.geocoding.engine.version +should.exist json.geocoding.timestamp + +#? valid geojson +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings \ No newline at end of file diff --git a/test/ciao/autocomplete/null_island.coffee b/test/ciao/autocomplete/null_island.coffee new file mode 100644 index 00000000..e2f8f46f --- /dev/null +++ b/test/ciao/autocomplete/null_island.coffee @@ -0,0 +1,29 @@ + +#> null island +path: '/v1/autocomplete?text=a&lat=0&lon=0' + +#? 200 ok +response.statusCode.should.equal 200 +response.should.have.header 'charset', 'utf8' +response.should.have.header 'content-type', 'application/json; charset=utf-8' + +#? valid geocoding block +should.exist json.geocoding +should.exist json.geocoding.version +should.exist json.geocoding.attribution +should.exist json.geocoding.query +should.exist json.geocoding.engine +should.exist json.geocoding.engine.name +should.exist json.geocoding.engine.author +should.exist json.geocoding.engine.version +should.exist json.geocoding.timestamp + +#? valid geojson +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings \ No newline at end of file diff --git a/test/ciao/place/basic_place.coffee b/test/ciao/place/basic_place.coffee new file mode 100644 index 00000000..9e6f0e73 --- /dev/null +++ b/test/ciao/place/basic_place.coffee @@ -0,0 +1,29 @@ + +#> basic place +path: '/v1/place?id=geoname:1' + +#? 200 ok +response.statusCode.should.equal 200 +response.should.have.header 'charset', 'utf8' +response.should.have.header 'content-type', 'application/json; charset=utf-8' + +#? valid geocoding block +should.exist json.geocoding +should.exist json.geocoding.version +should.exist json.geocoding.attribution +should.exist json.geocoding.query +should.exist json.geocoding.engine +should.exist json.geocoding.engine.name +should.exist json.geocoding.engine.author +should.exist json.geocoding.engine.version +should.exist json.geocoding.timestamp + +#? valid geojson +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings \ No newline at end of file diff --git a/test/ciao/place/missing_id.coffee b/test/ciao/place/missing_id.coffee new file mode 100644 index 00000000..82bad4bf --- /dev/null +++ b/test/ciao/place/missing_id.coffee @@ -0,0 +1,30 @@ + +#> missing id +path: '/v1/place' + +#? 200 ok +response.statusCode.should.equal 200 +response.should.have.header 'charset', 'utf8' +response.should.have.header 'content-type', 'application/json; charset=utf-8' + +#? valid geocoding block +should.exist json.geocoding +should.exist json.geocoding.version +should.exist json.geocoding.attribution +should.exist json.geocoding.query +should.exist json.geocoding.engine +should.exist json.geocoding.engine.name +should.exist json.geocoding.engine.author +should.exist json.geocoding.engine.version +should.exist json.geocoding.timestamp + +#? valid geojson +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.exist json.geocoding.errors +json.geocoding.errors.should.eql [ 'invalid param \'id\': text length, must be >0' ] + +#? expected warnings +should.not.exist json.geocoding.warnings \ No newline at end of file diff --git a/test/ciao/place/msuccess.coffee b/test/ciao/place/msuccess.coffee deleted file mode 100644 index 8f1b0056..00000000 --- a/test/ciao/place/msuccess.coffee +++ /dev/null @@ -1,16 +0,0 @@ - -#> valid place query -path: '/v1/place?id=geoname:4221195&id=geoname:4193595' - -#? 200 ok -response.statusCode.should.equal 200 - -#? valid response -now = new Date().getTime() -should.exist json -should.not.exist json.error -json.date.should.be.within now-5000, now+5000 - -#? valid geojson -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array diff --git a/test/ciao/place/success.coffee b/test/ciao/place/success.coffee deleted file mode 100644 index 323046a0..00000000 --- a/test/ciao/place/success.coffee +++ /dev/null @@ -1,16 +0,0 @@ - -#> valid place query -path: '/v1/place?id=geoname:4221195' - -#? 200 ok -response.statusCode.should.equal 200 - -#? valid response -now = new Date().getTime() -should.exist json -should.not.exist json.error -json.date.should.be.within now-5000, now+5000 - -#? valid geojson -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array diff --git a/test/ciao/reverse/basic_reverse.coffee b/test/ciao/reverse/basic_reverse.coffee new file mode 100644 index 00000000..bba41310 --- /dev/null +++ b/test/ciao/reverse/basic_reverse.coffee @@ -0,0 +1,29 @@ + +#> basic reverse +path: '/v1/reverse?point.lat=1&point.lon=2' + +#? 200 ok +response.statusCode.should.equal 200 +response.should.have.header 'charset', 'utf8' +response.should.have.header 'content-type', 'application/json; charset=utf-8' + +#? valid geocoding block +should.exist json.geocoding +should.exist json.geocoding.version +should.exist json.geocoding.attribution +should.exist json.geocoding.query +should.exist json.geocoding.engine +should.exist json.geocoding.engine.name +should.exist json.geocoding.engine.author +should.exist json.geocoding.engine.version +should.exist json.geocoding.timestamp + +#? valid geojson +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings \ No newline at end of file diff --git a/test/ciao/reverse/null_island.coffee b/test/ciao/reverse/null_island.coffee new file mode 100644 index 00000000..f1d26d38 --- /dev/null +++ b/test/ciao/reverse/null_island.coffee @@ -0,0 +1,29 @@ + +#> null island +path: '/v1/reverse?point.lat=0&point.lon=0' + +#? 200 ok +response.statusCode.should.equal 200 +response.should.have.header 'charset', 'utf8' +response.should.have.header 'content-type', 'application/json; charset=utf-8' + +#? valid geocoding block +should.exist json.geocoding +should.exist json.geocoding.version +should.exist json.geocoding.attribution +should.exist json.geocoding.query +should.exist json.geocoding.engine +should.exist json.geocoding.engine.name +should.exist json.geocoding.engine.author +should.exist json.geocoding.engine.version +should.exist json.geocoding.timestamp + +#? valid geojson +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings \ No newline at end of file diff --git a/test/ciao/reverse/success.coffee b/test/ciao/reverse/success.coffee deleted file mode 100644 index 78c73832..00000000 --- a/test/ciao/reverse/success.coffee +++ /dev/null @@ -1,15 +0,0 @@ -#> valid reverse query -path: '/v1/reverse?lat=29.49136&lon=-82.50622' - -#? 200 ok -response.statusCode.should.equal 200 - -#? valid response -now = new Date().getTime() -should.exist json -should.not.exist json.error -json.date.should.be.within now-5000, now+5000 - -#? valid geojson -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array diff --git a/test/ciao/search/basic_search.coffee b/test/ciao/search/basic_search.coffee new file mode 100644 index 00000000..5db527be --- /dev/null +++ b/test/ciao/search/basic_search.coffee @@ -0,0 +1,29 @@ + +#> basic search +path: '/v1/search?text=a' + +#? 200 ok +response.statusCode.should.equal 200 +response.should.have.header 'charset', 'utf8' +response.should.have.header 'content-type', 'application/json; charset=utf-8' + +#? valid geocoding block +should.exist json.geocoding +should.exist json.geocoding.version +should.exist json.geocoding.attribution +should.exist json.geocoding.query +should.exist json.geocoding.engine +should.exist json.geocoding.engine.name +should.exist json.geocoding.engine.author +should.exist json.geocoding.engine.version +should.exist json.geocoding.timestamp + +#? valid geojson +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings \ No newline at end of file diff --git a/test/ciao/search/null_island.coffee b/test/ciao/search/null_island.coffee new file mode 100644 index 00000000..5d3d46d5 --- /dev/null +++ b/test/ciao/search/null_island.coffee @@ -0,0 +1,29 @@ + +#> null island +path: '/v1/search?text=a&focus.point.lat=0&focus.point.lon=0' + +#? 200 ok +response.statusCode.should.equal 200 +response.should.have.header 'charset', 'utf8' +response.should.have.header 'content-type', 'application/json; charset=utf-8' + +#? valid geocoding block +should.exist json.geocoding +should.exist json.geocoding.version +should.exist json.geocoding.attribution +should.exist json.geocoding.query +should.exist json.geocoding.engine +should.exist json.geocoding.engine.name +should.exist json.geocoding.engine.author +should.exist json.geocoding.engine.version +should.exist json.geocoding.timestamp + +#? valid geojson +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings \ No newline at end of file diff --git a/test/ciao/search/success.coffee b/test/ciao/search/success.coffee deleted file mode 100644 index 9e37a5f4..00000000 --- a/test/ciao/search/success.coffee +++ /dev/null @@ -1,15 +0,0 @@ -#> valid search query -path: '/v1/search?text=lake&lat=29.49136&lon=-82.50622' - -#? 200 ok -response.statusCode.should.equal 200 - -#? valid response -now = new Date().getTime() -should.exist json -should.not.exist json.error -json.date.should.be.within now-5000, now+5000 - -#? valid geojson -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array diff --git a/test/ciao/suggest/nearby_nobias.coffee b/test/ciao/suggest/nearby_nobias.coffee deleted file mode 100644 index 295f0740..00000000 --- a/test/ciao/suggest/nearby_nobias.coffee +++ /dev/null @@ -1,6 +0,0 @@ - -#> suggest without geo bias -path: '/v1/suggest/nearby?text=a' - -#? 400 bad request -response.statusCode.should.equal 400 diff --git a/test/ciao/suggest/success.coffee b/test/ciao/suggest/success.coffee deleted file mode 100644 index e33b3f56..00000000 --- a/test/ciao/suggest/success.coffee +++ /dev/null @@ -1,16 +0,0 @@ - -#> valid suggest query -path: '/v1/suggest?text=a&lat=0&lon=0' - -#? 200 ok -response.statusCode.should.equal 200 - -#? valid response -now = new Date().getTime() -should.exist json -should.not.exist json.error -json.date.should.be.within now-5000, now+5000 - -#? valid geojson -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array diff --git a/test/ciao/suggest/success_nearby.coffee b/test/ciao/suggest/success_nearby.coffee deleted file mode 100644 index 35282a47..00000000 --- a/test/ciao/suggest/success_nearby.coffee +++ /dev/null @@ -1,16 +0,0 @@ - -#> valid suggest query -path: '/v1/suggest/nearby?text=a&lat=29.49136&lon=-82.50622' - -#? 200 ok -response.statusCode.should.equal 200 - -#? valid response -now = new Date().getTime() -should.exist json -should.not.exist json.error -json.date.should.be.within now-5000, now+5000 - -#? valid geojson -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array