mirror of https://github.com/pelias/api.git
Peter Johnson a.k.a. insertcoffee
9 years ago
10 changed files with 0 additions and 1071 deletions
@ -1,63 +0,0 @@
|
||||
# invalid path |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/notexist" |
||||
} |
||||
``` |
||||
|
||||
## Response |
||||
```javascript |
||||
Status: 404 |
||||
{ |
||||
"x-powered-by": "mapzen", |
||||
"charset": "utf8", |
||||
"cache-control": "public,max-age=300", |
||||
"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": "35", |
||||
"etag": "W/\"23-dfdfa185\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:19 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"error": "not found: invalid path" |
||||
} |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ not found |
||||
```javascript |
||||
response.statusCode.should.equal 404 |
||||
``` |
||||
|
||||
### ✓ content-type header correctly set |
||||
```javascript |
||||
response.should.have.header 'Content-Type','application/json; charset=utf-8' |
||||
``` |
||||
|
||||
### ✓ cache-control header correctly set |
||||
```javascript |
||||
response.should.have.header 'Cache-Control','public,max-age=300' |
||||
``` |
||||
|
||||
### ✓ should respond in json with server info |
||||
```javascript |
||||
should.exist json |
||||
should.exist json.error |
||||
json.error.should.equal 'not found: invalid path' |
||||
``` |
||||
|
@ -1,52 +0,0 @@
|
||||
# cross-origin resource sharing |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/" |
||||
} |
||||
``` |
||||
|
||||
## 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": "50", |
||||
"etag": "W/\"32-85536434\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:19 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"name": "pelias-api", |
||||
"version": { |
||||
"number": "0.0.0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ access control headers correctly set |
||||
```javascript |
||||
response.should.have.header 'Access-Control-Allow-Origin','*' |
||||
response.should.have.header 'Access-Control-Allow-Methods','GET' |
||||
response.should.have.header 'Access-Control-Allow-Headers','X-Requested-With,content-type' |
||||
response.should.have.header 'Access-Control-Allow-Credentials','true' |
||||
``` |
||||
|
@ -1,97 +0,0 @@
|
||||
# valid doc query |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/doc?id=geoname:4221195&id=geoname:4193595" |
||||
} |
||||
``` |
||||
|
||||
## 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": "555", |
||||
"etag": "W/\"22b-dd736629\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:19 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"type": "FeatureCollection", |
||||
"features": [ |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.9207, |
||||
34.36094 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Sanders Grove Cemetery", |
||||
"admin0": "United States", |
||||
"admin1": "Georgia", |
||||
"admin2": "Hart County", |
||||
"text": "Sanders Grove Cemetery, Hart County, Georgia" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-83.94213, |
||||
33.32262 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Etheredge Cemetery", |
||||
"admin0": "United States", |
||||
"admin1": "Georgia", |
||||
"admin2": "Butts County", |
||||
"text": "Etheredge Cemetery, Butts County, Georgia" |
||||
} |
||||
} |
||||
], |
||||
"date": 1415292259726 |
||||
} |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ 200 ok |
||||
```javascript |
||||
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() |
||||
should.exist json |
||||
should.not.exist json.error |
||||
json.date.should.be.within now-5000, now+5000 |
||||
``` |
||||
|
@ -1,80 +0,0 @@
|
||||
# valid doc query |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:20 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/doc?id=geoname:4221195" |
||||
} |
||||
``` |
||||
|
||||
## 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": "311", |
||||
"etag": "W/\"137-1644173e\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:20 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"type": "FeatureCollection", |
||||
"features": [ |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.9207, |
||||
34.36094 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Sanders Grove Cemetery", |
||||
"admin0": "United States", |
||||
"admin1": "Georgia", |
||||
"admin2": "Hart County", |
||||
"text": "Sanders Grove Cemetery, Hart County, Georgia" |
||||
} |
||||
} |
||||
], |
||||
"date": 1415292260057 |
||||
} |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ valid geojson |
||||
```javascript |
||||
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 |
||||
``` |
||||
|
||||
### ✓ 200 ok |
||||
```javascript |
||||
response.statusCode.should.equal 200 |
||||
``` |
||||
|
@ -1,82 +0,0 @@
|
||||
# api root |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/" |
||||
} |
||||
``` |
||||
|
||||
## 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": "50", |
||||
"etag": "W/\"32-85536434\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:19 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"name": "pelias-api", |
||||
"version": { |
||||
"number": "0.0.0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ charset header correctly set |
||||
```javascript |
||||
response.should.have.header 'Charset','utf8' |
||||
``` |
||||
|
||||
### ✓ endpoint available |
||||
```javascript |
||||
response.statusCode.should.equal 200 |
||||
``` |
||||
|
||||
### ✓ server header correctly set |
||||
```javascript |
||||
response.should.have.header 'Server' |
||||
response.headers.server.should.match /Pelias\/\d{1,2}\.\d{1,2}\.\d{1,2}/ |
||||
``` |
||||
|
||||
### ✓ should respond in json with server info |
||||
```javascript |
||||
should.exist json |
||||
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' |
||||
``` |
||||
|
||||
### ✓ cache-control header correctly set |
||||
```javascript |
||||
response.should.have.header 'Cache-Control','public,max-age=60' |
||||
``` |
||||
|
@ -1,50 +0,0 @@
|
||||
# jsonp |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/?callback=test" |
||||
} |
||||
``` |
||||
|
||||
## 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/javascript; charset=utf-8", |
||||
"content-length": "57", |
||||
"etag": "W/\"39-b8a2aba1\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:19 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```html |
||||
test({"name":"pelias-api","version":{"number":"0.0.0"}}); |
||||
``` |
||||
|
||||
## Tests |
||||
|
||||
### ✓ content-type header correctly set |
||||
```javascript |
||||
response.should.have.header 'Content-Type','application/javascript; charset=utf-8' |
||||
``` |
||||
|
||||
### ✓ should respond with jsonp |
||||
```javascript |
||||
should.exist response.body |
||||
response.body.substr(0,5).should.equal 'test('; |
||||
``` |
||||
|
@ -1,80 +0,0 @@
|
||||
# valid reverse query |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/reverse?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": "282", |
||||
"etag": "W/\"11a-efcd00c9\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:19 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"type": "FeatureCollection", |
||||
"features": [ |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.50622, |
||||
29.49136 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Adam", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Alachua County", |
||||
"text": "Adam, Alachua County, Florida" |
||||
} |
||||
} |
||||
], |
||||
"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 |
||||
``` |
||||
|
||||
### ✓ valid geojson |
||||
```javascript |
||||
json.type.should.equal 'FeatureCollection' |
||||
json.features.should.be.instanceof Array |
||||
``` |
||||
|
@ -1,233 +0,0 @@
|
||||
# valid search query |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/search?text=lake&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": "2398", |
||||
"etag": "W/\"NldeHivz2maJ3rqa73a+2w==\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:19 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"type": "FeatureCollection", |
||||
"features": [ |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.5052, |
||||
29.50312 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Blue Pete Lake", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Alachua County", |
||||
"text": "Blue Pete Lake, Alachua County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.52097, |
||||
29.47185 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Sawgrass Lake", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Levy County", |
||||
"text": "Sawgrass Lake, Levy County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.39141, |
||||
29.4468 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Johnson Lake", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Marion County", |
||||
"text": "Johnson Lake, Marion County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.35435, |
||||
29.49526 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Ledwith Lake", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Alachua County", |
||||
"text": "Ledwith Lake, Alachua County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.35316, |
||||
29.52469 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Levy Lake", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Alachua County", |
||||
"text": "Levy Lake, Alachua County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.66311, |
||||
29.54036 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Fox Lake", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Levy County", |
||||
"text": "Fox Lake, Levy County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.40502, |
||||
29.61705 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Lake Kanapaha", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Alachua County", |
||||
"text": "Lake Kanapaha, Alachua County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.70856, |
||||
29.53293 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Doorshutter Lake", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Levy County", |
||||
"text": "Doorshutter Lake, Levy County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.30215, |
||||
29.52978 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Wauberg Lake", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Alachua County", |
||||
"text": "Wauberg Lake, Alachua County, Florida" |
||||
} |
||||
}, |
||||
{ |
||||
"type": "Feature", |
||||
"geometry": { |
||||
"type": "Point", |
||||
"coordinates": [ |
||||
-82.47914, |
||||
29.30795 |
||||
] |
||||
}, |
||||
"properties": { |
||||
"name": "Lake Stafford", |
||||
"admin0": "United States", |
||||
"admin1": "Florida", |
||||
"admin2": "Levy County", |
||||
"text": "Lake Stafford, Levy County, Florida" |
||||
} |
||||
} |
||||
], |
||||
"date": 1415292259730 |
||||
} |
||||
``` |
||||
|
||||
## 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 |
||||
``` |
||||
|
||||
### ✓ valid geojson |
||||
```javascript |
||||
json.type.should.equal 'FeatureCollection' |
||||
json.features.should.be.instanceof Array |
||||
``` |
||||
|
@ -1,111 +0,0 @@
|
||||
# valid suggest query |
||||
|
||||
*Generated: Thu Nov 06 2014 11:44:19 GMT-0500 (EST)* |
||||
## Request |
||||
```javascript |
||||
{ |
||||
"protocol": "http:", |
||||
"host": "localhost", |
||||
"method": "GET", |
||||
"port": 3100, |
||||
"path": "/suggest?text=a&lat=0&lon=0" |
||||
} |
||||
``` |
||||
|
||||
## 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": "571", |
||||
"etag": "W/\"23b-5d6e3dd3\"", |
||||
"date": "Thu, 06 Nov 2014 16:44:19 GMT", |
||||
"connection": "close" |
||||
} |
||||
``` |
||||
```javascript |
||||
{ |
||||
"type": "FeatureCollection", |
||||
"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 |
||||
|
||||
### ✓ valid geojson |
||||
```javascript |
||||
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 |
||||
``` |
||||
|
||||
### ✓ 200 ok |
||||
```javascript |
||||
response.statusCode.should.equal 200 |
||||
``` |
||||
|
@ -1,223 +0,0 @@
|
||||
# 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?text=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 |
||||
``` |
||||
|
Loading…
Reference in new issue