mirror of https://github.com/pelias/api.git
Peter Johnson a.k.a. insertcoffee
9 years ago
22 changed files with 359 additions and 105 deletions
@ -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' |
@ -0,0 +1,33 @@
|
||||
|
||||
#> basic autocomplete |
||||
path: '/v1/autocomplete?text=a' |
||||
|
||||
#? 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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['text'].should.eql 'a' |
||||
json.geocoding.query['size'].should.eql 10 |
@ -0,0 +1,34 @@
|
||||
|
||||
#> null island |
||||
path: '/v1/autocomplete?text=a&focus.point.lat=0&focus.point.lon=0' |
||||
|
||||
#? 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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['lat'].should.eql 0 |
||||
json.geocoding.query['lon'].should.eql 0 |
||||
json.geocoding.query['size'].should.eql 10 |
@ -0,0 +1,33 @@
|
||||
|
||||
#> basic place |
||||
path: '/v1/place?id=geoname: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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['ids'].should.eql [{ id: '1', type: 'geoname' }] |
||||
should.not.exist json.geocoding.query['size'] |
@ -0,0 +1,34 @@
|
||||
|
||||
#> missing id |
||||
path: '/v1/place' |
||||
|
||||
#? 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.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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['ids'].should.eql [] |
||||
should.not.exist json.geocoding.query['size'] |
@ -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 |
@ -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 |
@ -0,0 +1,34 @@
|
||||
|
||||
#> basic reverse |
||||
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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['lat'].should.eql 1 |
||||
json.geocoding.query['lon'].should.eql 2 |
||||
json.geocoding.query['size'].should.eql 10 |
@ -0,0 +1,34 @@
|
||||
|
||||
#> null island |
||||
path: '/v1/reverse?point.lat=0&point.lon=0' |
||||
|
||||
#? 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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['lat'].should.eql 0 |
||||
json.geocoding.query['lon'].should.eql 0 |
||||
json.geocoding.query['size'].should.eql 10 |
@ -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 |
@ -0,0 +1,41 @@
|
||||
|
||||
#> address parsing |
||||
path: '/v1/search?text=30%20w%2026th%20st%2C%20ny' |
||||
|
||||
#? 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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['text'].should.eql '30 w 26th st, ny' |
||||
json.geocoding.query['size'].should.eql 10 |
||||
|
||||
#? address parsing |
||||
json.geocoding.query.parsed_text['name'].should.eql '30 w 26th st' |
||||
json.geocoding.query.parsed_text['number'].should.eql 30 |
||||
json.geocoding.query.parsed_text['street'].should.eql 'w 26th st' |
||||
json.geocoding.query.parsed_text['state'].should.eql 'NY' |
||||
json.geocoding.query.parsed_text['regions'].should.eql [] |
||||
json.geocoding.query.parsed_text['admin_parts'].should.eql "ny" |
@ -0,0 +1,33 @@
|
||||
|
||||
#> basic search |
||||
path: '/v1/search?text=a' |
||||
|
||||
#? 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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['text'].should.eql 'a' |
||||
json.geocoding.query['size'].should.eql 10 |
@ -0,0 +1,33 @@
|
||||
|
||||
#> no params specified |
||||
path: '/v1/search' |
||||
|
||||
#? 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.exist json.geocoding.errors |
||||
json.geocoding.errors.should.eql [ 'invalid param \'text\': text length, must be >0' ] |
||||
|
||||
#? expected warnings |
||||
should.not.exist json.geocoding.warnings |
||||
|
||||
#? inputs |
||||
json.geocoding.query['size'].should.eql 10 |
@ -0,0 +1,35 @@
|
||||
|
||||
#> null island |
||||
path: '/v1/search?text=a&focus.point.lat=0&focus.point.lon=0' |
||||
|
||||
#? 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 |
||||
|
||||
#? inputs |
||||
json.geocoding.query['text'].should.eql 'a' |
||||
json.geocoding.query['size'].should.eql 10 |
||||
json.geocoding.query['lat'].should.eql 0 |
||||
json.geocoding.query['lon'].should.eql 0 |
@ -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 |
@ -1,6 +0,0 @@
|
||||
|
||||
#> suggest without geo bias |
||||
path: '/v1/suggest/nearby?text=a' |
||||
|
||||
#? 400 bad request |
||||
response.statusCode.should.equal 400 |
@ -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 |
@ -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 |
Loading…
Reference in new issue