diff --git a/docs/404.md b/docs/404.md index 66a3567d..917c5ad4 100644 --- a/docs/404.md +++ b/docs/404.md @@ -1,6 +1,6 @@ # invalid path -*Generated: Thu Oct 23 2014 11:58:14 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* ## Request ```javascript { @@ -27,7 +27,7 @@ Status: 404 "content-type": "application/json; charset=utf-8", "content-length": "35", "etag": "W/\"23-dfdfa185\"", - "date": "Thu, 23 Oct 2014 15:58:14 GMT", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", "connection": "close" } ``` @@ -39,9 +39,9 @@ Status: 404 ## Tests -### ✓ cache-control header correctly set +### ✓ not found ```javascript -response.should.have.header 'Cache-Control','public,max-age=300' +response.statusCode.should.equal 404 ``` ### ✓ content-type header correctly set @@ -49,9 +49,9 @@ response.should.have.header 'Cache-Control','public,max-age=300' response.should.have.header 'Content-Type','application/json; charset=utf-8' ``` -### ✓ not found +### ✓ cache-control header correctly set ```javascript -response.statusCode.should.equal 404 +response.should.have.header 'Cache-Control','public,max-age=300' ``` ### ✓ should respond in json with server info diff --git a/docs/cors.md b/docs/cors.md index 1f6e7e46..17ddda39 100644 --- a/docs/cors.md +++ b/docs/cors.md @@ -1,6 +1,6 @@ # cross-origin resource sharing -*Generated: Thu Oct 23 2014 11:58:14 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* ## Request ```javascript { @@ -27,7 +27,7 @@ Status: 200 "content-type": "application/json; charset=utf-8", "content-length": "50", "etag": "W/\"32-85536434\"", - "date": "Thu, 23 Oct 2014 15:58:14 GMT", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", "connection": "close" } ``` diff --git a/docs/doc/msuccess.md b/docs/doc/msuccess.md index c9f3d8c9..1f510a42 100644 --- a/docs/doc/msuccess.md +++ b/docs/doc/msuccess.md @@ -1,6 +1,6 @@ # valid doc query -*Generated: Thu Oct 23 2014 11:58:14 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* ## Request ```javascript { @@ -26,8 +26,8 @@ Status: 200 "access-control-allow-credentials": "true", "content-type": "application/json; charset=utf-8", "content-length": "555", - "etag": "W/\"22b-6aa14642\"", - "date": "Thu, 23 Oct 2014 15:58:14 GMT", + "etag": "W/\"22b-dd736629\"", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", "connection": "close" } ``` @@ -70,7 +70,7 @@ Status: 200 } } ], - "date": 1414079894512 + "date": 1415292259726 } ``` @@ -81,6 +81,12 @@ Status: 200 response.statusCode.should.equal 200 ``` +### ✓ valid geojson +```javascript +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array +``` + ### ✓ valid response ```javascript now = new Date().getTime() @@ -89,9 +95,3 @@ should.not.exist json.error json.date.should.be.within now-5000, now+5000 ``` -### ✓ valid geojson -```javascript -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array -``` - diff --git a/docs/doc/success.md b/docs/doc/success.md index 34179af0..a6dd6c00 100644 --- a/docs/doc/success.md +++ b/docs/doc/success.md @@ -1,6 +1,6 @@ # valid doc query -*Generated: Thu Oct 23 2014 11:58:14 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:20 GMT-0500 (EST)* ## Request ```javascript { @@ -26,8 +26,8 @@ Status: 200 "access-control-allow-credentials": "true", "content-type": "application/json; charset=utf-8", "content-length": "311", - "etag": "W/\"137-ab9138f7\"", - "date": "Thu, 23 Oct 2014 15:58:14 GMT", + "etag": "W/\"137-1644173e\"", + "date": "Thu, 06 Nov 2014 16:44:20 GMT", "connection": "close" } ``` @@ -53,12 +53,18 @@ Status: 200 } } ], - "date": 1414079894512 + "date": 1415292260057 } ``` ## Tests +### ✓ valid geojson +```javascript +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array +``` + ### ✓ valid response ```javascript now = new Date().getTime() @@ -72,9 +78,3 @@ json.date.should.be.within now-5000, now+5000 response.statusCode.should.equal 200 ``` -### ✓ valid geojson -```javascript -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array -``` - diff --git a/docs/index.md b/docs/index.md index a386d38f..cde683b5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # api root -*Generated: Thu Oct 23 2014 11:58:14 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* ## Request ```javascript { @@ -27,7 +27,7 @@ Status: 200 "content-type": "application/json; charset=utf-8", "content-length": "50", "etag": "W/\"32-85536434\"", - "date": "Thu, 23 Oct 2014 15:58:14 GMT", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", "connection": "close" } ``` @@ -42,6 +42,11 @@ Status: 200 ## Tests +### ✓ charset header correctly set +```javascript +response.should.have.header 'Charset','utf8' +``` + ### ✓ endpoint available ```javascript response.statusCode.should.equal 200 @@ -53,16 +58,6 @@ response.should.have.header 'Server' response.headers.server.should.match /Pelias\/\d{1,2}\.\d{1,2}\.\d{1,2}/ ``` -### ✓ vanity header correctly set -```javascript -response.should.have.header 'X-Powered-By','mapzen' -``` - -### ✓ cache-control header correctly set -```javascript -response.should.have.header 'Cache-Control','public,max-age=60' -``` - ### ✓ should respond in json with server info ```javascript should.exist json @@ -70,13 +65,18 @@ should.exist json.name should.exist json.version ``` +### ✓ vanity header correctly set +```javascript +response.should.have.header 'X-Powered-By','mapzen' +``` + ### ✓ content-type header correctly set ```javascript response.should.have.header 'Content-Type','application/json; charset=utf-8' ``` -### ✓ charset header correctly set +### ✓ cache-control header correctly set ```javascript -response.should.have.header 'Charset','utf8' +response.should.have.header 'Cache-Control','public,max-age=60' ``` diff --git a/docs/jsonp.md b/docs/jsonp.md index f4ba0eca..b8c08577 100644 --- a/docs/jsonp.md +++ b/docs/jsonp.md @@ -1,6 +1,6 @@ # jsonp -*Generated: Thu Oct 23 2014 11:58:14 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* ## Request ```javascript { @@ -27,7 +27,7 @@ Status: 200 "content-type": "application/javascript; charset=utf-8", "content-length": "57", "etag": "W/\"39-b8a2aba1\"", - "date": "Thu, 23 Oct 2014 15:58:14 GMT", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", "connection": "close" } ``` @@ -37,14 +37,14 @@ test({"name":"pelias-api","version":{"number":"0.0.0"}}); ## Tests -### ✓ should respond with jsonp +### ✓ content-type header correctly set ```javascript -should.exist response.body -response.body.substr(0,5).should.equal 'test('; +response.should.have.header 'Content-Type','application/javascript; charset=utf-8' ``` -### ✓ content-type header correctly set +### ✓ should respond with jsonp ```javascript -response.should.have.header 'Content-Type','application/javascript; charset=utf-8' +should.exist response.body +response.body.substr(0,5).should.equal 'test('; ``` diff --git a/docs/reverse/success.md b/docs/reverse/success.md index 1813aab7..cb7e84e1 100644 --- a/docs/reverse/success.md +++ b/docs/reverse/success.md @@ -1,6 +1,6 @@ # valid reverse query -*Generated: Thu Oct 23 2014 11:58:15 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* ## Request ```javascript { @@ -26,8 +26,8 @@ Status: 200 "access-control-allow-credentials": "true", "content-type": "application/json; charset=utf-8", "content-length": "282", - "etag": "W/\"11a-95fc1500\"", - "date": "Thu, 23 Oct 2014 15:58:15 GMT", + "etag": "W/\"11a-efcd00c9\"", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", "connection": "close" } ``` @@ -53,12 +53,20 @@ Status: 200 } } ], - "date": 1414079895606 + "date": 1415292259729 } ``` ## Tests +### ✓ valid response +```javascript +now = new Date().getTime() +should.exist json +should.not.exist json.error +json.date.should.be.within now-5000, now+5000 +``` + ### ✓ 200 ok ```javascript response.statusCode.should.equal 200 @@ -70,11 +78,3 @@ json.type.should.equal 'FeatureCollection' json.features.should.be.instanceof Array ``` -### ✓ valid response -```javascript -now = new Date().getTime() -should.exist json -should.not.exist json.error -json.date.should.be.within now-5000, now+5000 -``` - diff --git a/docs/search/success.md b/docs/search/success.md index 6b64c548..50789c87 100644 --- a/docs/search/success.md +++ b/docs/search/success.md @@ -1,6 +1,6 @@ # valid search query -*Generated: Thu Oct 23 2014 11:58:15 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* ## Request ```javascript { @@ -26,8 +26,8 @@ Status: 200 "access-control-allow-credentials": "true", "content-type": "application/json; charset=utf-8", "content-length": "2398", - "etag": "W/\"0tqT2h50EMVuqDtvmB5nAQ==\"", - "date": "Thu, 23 Oct 2014 15:58:15 GMT", + "etag": "W/\"NldeHivz2maJ3rqa73a+2w==\"", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", "connection": "close" } ``` @@ -206,7 +206,7 @@ Status: 200 } } ], - "date": 1414079895605 + "date": 1415292259730 } ``` @@ -220,14 +220,14 @@ should.not.exist json.error json.date.should.be.within now-5000, now+5000 ``` -### ✓ valid geojson +### ✓ 200 ok ```javascript -json.type.should.equal 'FeatureCollection' -json.features.should.be.instanceof Array +response.statusCode.should.equal 200 ``` -### ✓ 200 ok +### ✓ valid geojson ```javascript -response.statusCode.should.equal 200 +json.type.should.equal 'FeatureCollection' +json.features.should.be.instanceof Array ``` diff --git a/docs/suggest/success.md b/docs/suggest/success.md index bc120b2c..8c430b53 100644 --- a/docs/suggest/success.md +++ b/docs/suggest/success.md @@ -1,6 +1,6 @@ # valid suggest query -*Generated: Thu Oct 23 2014 11:58:14 GMT-0400 (EDT)* +*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* ## Request ```javascript { @@ -25,27 +25,71 @@ Status: 200 "access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-credentials": "true", "content-type": "application/json; charset=utf-8", - "content-length": "63", - "etag": "W/\"3f-200731a6\"", - "date": "Thu, 23 Oct 2014 15:58:14 GMT", + "content-length": "571", + "etag": "W/\"23b-5d6e3dd3\"", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", "connection": "close" } ``` ```javascript { "type": "FeatureCollection", - "features": [], - "date": 1414079894479 + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -8.481618, + 43.125692 + ] + }, + "properties": { + "text": "A Coruña", + "score": 14, + "type": "admin1", + "id": "3374:adm1:es:esp:a_coru_a" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + 7.56019, + 5.419786 + ] + }, + "properties": { + "text": "Abia", + "score": 14, + "type": "admin1", + "id": "1775:adm1:ng:nga:abia" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + 33.772337, + 2.826081 + ] + }, + "properties": { + "text": "Abim", + "score": 14, + "type": "admin1", + "id": "2848:adm1:ug:uga:abim" + } + } + ], + "date": 1415292259700 } ``` ## Tests -### ✓ 200 ok -```javascript -response.statusCode.should.equal 200 -``` - ### ✓ valid geojson ```javascript json.type.should.equal 'FeatureCollection' @@ -60,3 +104,8 @@ should.not.exist json.error json.date.should.be.within now-5000, now+5000 ``` +### ✓ 200 ok +```javascript +response.statusCode.should.equal 200 +``` + diff --git a/docs/suggest/success_nearby.md b/docs/suggest/success_nearby.md new file mode 100644 index 00000000..c29643c2 --- /dev/null +++ b/docs/suggest/success_nearby.md @@ -0,0 +1,223 @@ +# valid suggest query + +*Generated: Thu Nov 06 2014 11:44:20 GMT-0500 (EST)* +## Request +```javascript +{ + "protocol": "http:", + "host": "localhost", + "method": "GET", + "port": 3100, + "path": "/suggest/nearby?input=a&lat=29.49136&lon=-82.50622" +} +``` + +## Response +```javascript +Status: 200 +{ + "x-powered-by": "mapzen", + "charset": "utf8", + "cache-control": "public,max-age=60", + "server": "Pelias/0.0.0", + "access-control-allow-origin": "*", + "access-control-allow-methods": "GET", + "access-control-allow-headers": "X-Requested-With,content-type", + "access-control-allow-credentials": "true", + "content-type": "application/json; charset=utf-8", + "content-length": "2034", + "etag": "W/\"Do9VJ5hCbynTxDjtm5fNlg==\"", + "date": "Thu, 06 Nov 2014 16:44:19 GMT", + "connection": "close" +} +``` +```javascript +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.05231, + 29.17998 + ] + }, + "properties": { + "text": "Abiding Hope E V Lutheran Church, Marion County, Florida", + "score": 1, + "type": "geoname", + "id": "4145572" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.10231, + 29.21942 + ] + }, + "properties": { + "text": "Abundant Harvest Ministries, Marion County, Florida", + "score": 1, + "type": "geoname", + "id": "4145578" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.50622, + 29.49136 + ] + }, + "properties": { + "text": "Adam, Alachua County, Florida", + "score": 1, + "type": "geoname", + "id": "4145612" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.75374, + 35.17789 + ] + }, + "properties": { + "text": "Adams Branch, Transylvania County, North Carolina", + "score": 1, + "type": "geoname", + "id": "4452189" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.83012, + 29.4783 + ] + }, + "properties": { + "text": "Adamsville Cemetery, Levy County, Florida", + "score": 1, + "type": "geoname", + "id": "4145634" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.01511, + 35.17289 + ] + }, + "properties": { + "text": "Africa School (historical), Spartanburg County, South Carolina", + "score": 1, + "type": "geoname", + "id": "4569065" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.20426, + 29.25192 + ] + }, + "properties": { + "text": "Agape Baptist Church, Marion County, Florida", + "score": 1, + "type": "geoname", + "id": "4145673" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.14954, + 29.19248 + ] + }, + "properties": { + "text": "Agnew Cemetery, Marion County, Florida", + "score": 1, + "type": "geoname", + "id": "4145677" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.75429, + 35.16928 + ] + }, + "properties": { + "text": "Aiken Mountain, Transylvania County, North Carolina", + "score": 1, + "type": "geoname", + "id": "4452268" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -82.15912, + 29.47877 + ] + }, + "properties": { + "text": "Alachua County Fire Rescue Station 31, Alachua County, Florida", + "score": 1, + "type": "geoname", + "id": "4152402" + } + } + ], + "date": 1415292259785 +} +``` + +## Tests + +### ✓ 200 ok +```javascript +response.statusCode.should.equal 200 +``` + +### ✓ valid response +```javascript +now = new Date().getTime() +should.exist json +should.not.exist json.error +json.date.should.be.within now-5000, now+5000 +``` + +### ✓ valid geojson +```javascript +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 new file mode 100644 index 00000000..ca958720 --- /dev/null +++ b/test/ciao/suggest/success_nearby.coffee @@ -0,0 +1,16 @@ + +#> valid suggest query +path: '/suggest/nearby?input=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 \ No newline at end of file