Browse Source

add ciao tests for language

pull/819/head
Peter Johnson 8 years ago
parent
commit
7749be549e
  1. 37
      test/ciao/autocomplete/language_default.coffee
  2. 38
      test/ciao/autocomplete/language_header_invalid.coffee
  3. 38
      test/ciao/autocomplete/language_header_valid.coffee
  4. 37
      test/ciao/place/language_default.coffee
  5. 38
      test/ciao/place/language_header_invalid.coffee
  6. 38
      test/ciao/place/language_header_valid.coffee
  7. 37
      test/ciao/reverse/language_default.coffee
  8. 38
      test/ciao/reverse/language_header_invalid.coffee
  9. 38
      test/ciao/reverse/language_header_valid.coffee
  10. 37
      test/ciao/search/language_default.coffee
  11. 38
      test/ciao/search/language_header_invalid.coffee
  12. 38
      test/ciao/search/language_header_valid.coffee

37
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
}

38
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
}

38
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'
}

37
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
}

38
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
}

38
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'
}

37
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
}

38
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
}

38
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'
}

37
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
}

38
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
}

38
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'
}
Loading…
Cancel
Save