diff --git a/test/ciao/autocomplete/language_default.coffee b/test/ciao/autocomplete/language_default.coffee new file mode 100644 index 00000000..3e39e8db --- /dev/null +++ b/test/ciao/autocomplete/language_default.coffee @@ -0,0 +1,37 @@ + +#> language +path: '/v1/autocomplete?text=example' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + name: 'English', + iso6391: 'en', + iso6393: 'eng', + defaulted: true +} diff --git a/test/ciao/autocomplete/language_header_invalid.coffee b/test/ciao/autocomplete/language_header_invalid.coffee new file mode 100644 index 00000000..0e9e8e41 --- /dev/null +++ b/test/ciao/autocomplete/language_header_invalid.coffee @@ -0,0 +1,38 @@ + +#> language +path: '/v1/autocomplete?text=example' +headers: 'Accept-Language': 'example' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + name: 'English', + iso6391: 'en', + iso6393: 'eng', + defaulted: true +} diff --git a/test/ciao/autocomplete/language_header_valid.coffee b/test/ciao/autocomplete/language_header_valid.coffee new file mode 100644 index 00000000..aea8c28c --- /dev/null +++ b/test/ciao/autocomplete/language_header_valid.coffee @@ -0,0 +1,38 @@ + +#> language +path: '/v1/autocomplete?text=example' +headers: 'Accept-Language': 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + defaulted: false, + iso6391: 'fr', + iso6393: 'fra', + name: 'French' +} diff --git a/test/ciao/place/language_default.coffee b/test/ciao/place/language_default.coffee new file mode 100644 index 00000000..444b6254 --- /dev/null +++ b/test/ciao/place/language_default.coffee @@ -0,0 +1,37 @@ + +#> language +path: '/v1/place?ids=geonames:venue:1' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + name: 'English', + iso6391: 'en', + iso6393: 'eng', + defaulted: true +} diff --git a/test/ciao/place/language_header_invalid.coffee b/test/ciao/place/language_header_invalid.coffee new file mode 100644 index 00000000..94cd167a --- /dev/null +++ b/test/ciao/place/language_header_invalid.coffee @@ -0,0 +1,38 @@ + +#> language +path: '/v1/place?ids=geonames:venue:1' +headers: 'Accept-Language': 'example' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + name: 'English', + iso6391: 'en', + iso6393: 'eng', + defaulted: true +} diff --git a/test/ciao/place/language_header_valid.coffee b/test/ciao/place/language_header_valid.coffee new file mode 100644 index 00000000..639d3b72 --- /dev/null +++ b/test/ciao/place/language_header_valid.coffee @@ -0,0 +1,38 @@ + +#> language +path: '/v1/place?ids=geonames:venue:1' +headers: 'Accept-Language': 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + defaulted: false, + iso6391: 'fr', + iso6393: 'fra', + name: 'French' +} diff --git a/test/ciao/reverse/language_default.coffee b/test/ciao/reverse/language_default.coffee new file mode 100644 index 00000000..659aa5c2 --- /dev/null +++ b/test/ciao/reverse/language_default.coffee @@ -0,0 +1,37 @@ + +#> language +path: '/v1/reverse?point.lat=1&point.lon=2' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + name: 'English', + iso6391: 'en', + iso6393: 'eng', + defaulted: true +} diff --git a/test/ciao/reverse/language_header_invalid.coffee b/test/ciao/reverse/language_header_invalid.coffee new file mode 100644 index 00000000..635de4e1 --- /dev/null +++ b/test/ciao/reverse/language_header_invalid.coffee @@ -0,0 +1,38 @@ + +#> language +path: '/v1/reverse?point.lat=1&point.lon=2' +headers: 'Accept-Language': 'example' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + name: 'English', + iso6391: 'en', + iso6393: 'eng', + defaulted: true +} diff --git a/test/ciao/reverse/language_header_valid.coffee b/test/ciao/reverse/language_header_valid.coffee new file mode 100644 index 00000000..bca45c1a --- /dev/null +++ b/test/ciao/reverse/language_header_valid.coffee @@ -0,0 +1,38 @@ + +#> language +path: '/v1/reverse?point.lat=1&point.lon=2' +headers: 'Accept-Language': 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + defaulted: false, + iso6391: 'fr', + iso6393: 'fra', + name: 'French' +} diff --git a/test/ciao/search/language_default.coffee b/test/ciao/search/language_default.coffee new file mode 100644 index 00000000..eb85265c --- /dev/null +++ b/test/ciao/search/language_default.coffee @@ -0,0 +1,37 @@ + +#> language +path: '/v1/search?text=example' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + name: 'English', + iso6391: 'en', + iso6393: 'eng', + defaulted: true +} diff --git a/test/ciao/search/language_header_invalid.coffee b/test/ciao/search/language_header_invalid.coffee new file mode 100644 index 00000000..af89aaf0 --- /dev/null +++ b/test/ciao/search/language_header_invalid.coffee @@ -0,0 +1,38 @@ + +#> language +path: '/v1/search?text=example' +headers: 'Accept-Language': 'example' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + name: 'English', + iso6391: 'en', + iso6393: 'eng', + defaulted: true +} diff --git a/test/ciao/search/language_header_valid.coffee b/test/ciao/search/language_header_valid.coffee new file mode 100644 index 00000000..4f3b958d --- /dev/null +++ b/test/ciao/search/language_header_valid.coffee @@ -0,0 +1,38 @@ + +#> language +path: '/v1/search?text=example' +headers: 'Accept-Language': 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5' + +#? 200 ok +response.statusCode.should.be.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.be.equal 'FeatureCollection' +json.features.should.be.instanceof Array + +#? expected errors +should.not.exist json.geocoding.errors + +#? expected warnings +should.not.exist json.geocoding.warnings + +#? language +json.geocoding.query['lang'].should.eql { + defaulted: false, + iso6391: 'fr', + iso6393: 'fra', + name: 'French' +}