From 1b83247964090597f05ce9d2ca14a7c4c412cf00 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Fri, 12 Aug 2016 13:31:05 -0400 Subject: [PATCH 1/8] exclude `name` for `country` result labels --- helper/labelGenerator.js | 10 ++++++++++ test/unit/helper/labelGenerator_default.js | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/helper/labelGenerator.js b/helper/labelGenerator.js index 97993e03..a7894896 100644 --- a/helper/labelGenerator.js +++ b/helper/labelGenerator.js @@ -56,10 +56,20 @@ function getInitialLabel(record) { return []; } + if (isCountry(record.layer)) { + return []; + } + return [record.name]; } +// this can go away once geonames is no longer supported +// https://github.com/pelias/wof-admin-lookup/issues/49 +function isCountry(layer) { + return 'country' === layer; +} + function isRegion(layer) { return 'region' === layer; } diff --git a/test/unit/helper/labelGenerator_default.js b/test/unit/helper/labelGenerator_default.js index 25991ab8..4679f136 100644 --- a/test/unit/helper/labelGenerator_default.js +++ b/test/unit/helper/labelGenerator_default.js @@ -175,14 +175,14 @@ module.exports.tests.default_country = function(test, common) { t.end(); }); - test('country', function(t) { + test('country layer labels should only use the `country` field and not the `name`', function(t) { var doc = { - 'name': 'country name', + 'name': 'source country name', 'layer': 'country', 'country_a': 'country code', - 'country': 'country name' + 'country': 'hierarchy country name' }; - t.equal(generator(doc),'country name'); + t.equal(generator(doc),'hierarchy country name'); t.end(); }); From a090a1e71a0d748d5e167625f0289aa57fa14a03 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Fri, 12 Aug 2016 13:46:09 -0400 Subject: [PATCH 2/8] updated comment --- helper/labelGenerator.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helper/labelGenerator.js b/helper/labelGenerator.js index a7894896..34112157 100644 --- a/helper/labelGenerator.js +++ b/helper/labelGenerator.js @@ -47,8 +47,7 @@ function getSchema(country_a) { } -// helper function that sets a default label for non-US/CA regions -// this is a very special case +// helper function that sets a default label for non-US/CA regions and countries function getInitialLabel(record) { if (isRegion(record.layer) && isGeonamesOrWhosOnFirst(record.source) && From a6ccbf17ce791f7effadd1eae9b235468454abf2 Mon Sep 17 00:00:00 2001 From: Alec Vulfson Date: Wed, 17 Aug 2016 17:29:49 -0400 Subject: [PATCH 3/8] Add provinces to Australian labels --- helper/labelSchema.js | 11 +- test/unit/helper/labelGenerator_AUS.js | 201 +++++++++++++++++++++++++ test/unit/helper/labelSchema.js | 4 +- test/unit/run.js | 1 + 4 files changed, 213 insertions(+), 4 deletions(-) create mode 100644 test/unit/helper/labelGenerator_AUS.js diff --git a/helper/labelSchema.js b/helper/labelSchema.js index 699e1c88..5cd6024b 100644 --- a/helper/labelSchema.js +++ b/helper/labelSchema.js @@ -13,12 +13,17 @@ module.exports = { 'USA': { 'borough': getFirstProperty(['borough']), 'local': getFirstProperty(['locality', 'localadmin', 'county']), - 'regional': getUsOrCaState, + 'regional': getUsOrCaOrAusState, 'country': getUSACountryValue }, + 'AUS': { + 'local' : getFirstProperty(['locality', 'localadmin']), + 'regional' : getUsOrCaOrAusState, + 'country': getFirstProperty(['country']) + }, 'CAN': { 'local': getFirstProperty(['locality']), // no localadmins in CAN - 'regional': getUsOrCaState, + 'regional': getUsOrCaOrAusState, 'country': getFirstProperty(['country']) } }; @@ -44,7 +49,7 @@ function getFirstProperty(fields) { // the full state name, eg: Pennsylvania, USA and Ontario, CA // 2. otherwise, the state abbreviation should be used, eg: Lancaster, PA, USA and Bruce, ON, CA // 3. if for some reason the abbreviation isn't available, use the full state name -function getUsOrCaState(record) { +function getUsOrCaOrAusState(record) { if ('region' === record.layer && record.region) { // return full state name when state is the most granular piece of info return record.region; diff --git a/test/unit/helper/labelGenerator_AUS.js b/test/unit/helper/labelGenerator_AUS.js new file mode 100644 index 00000000..e5617ee5 --- /dev/null +++ b/test/unit/helper/labelGenerator_AUS.js @@ -0,0 +1,201 @@ + +var generator = require('../../../helper/labelGenerator'); + +module.exports.tests = {}; + +module.exports.tests.interface = function(test, common) { + test('interface', function(t) { + t.equal(typeof generator, 'function', 'valid function'); + t.end(); + }); +}; + +module.exports.tests.australia = function(test, common) { + test('venue', function(t) { + var doc = { + 'name': 'venue name', + 'layer': 'venue', + 'housenumber': 'house number', + 'street': 'street name', + 'neighbourhood': 'neighbourhood name', + 'locality': 'locality name', + 'localadmin': 'localadmin name', + 'county': 'county name', + 'macrocounty': 'macrocounty name', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'venue name, locality name, region name, Australia'); + t.end(); + }); + + test('localadmin value should be used when locality is not available', function(t) { + var doc = { + 'name': 'venue name', + 'layer': 'venue', + 'housenumber': 'house number', + 'street': 'street name', + 'neighbourhood': 'neighbourhood name', + 'localadmin': 'localadmin name', + 'county': 'county name', + 'macrocounty': 'macrocounty name', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'venue name, localadmin name, region name, Australia'); + t.end(); + }); + + test('street', function(t) { + var doc = { + 'name': 'house number street name', + 'layer': 'address', + 'housenumber': 'house number', + 'street': 'street name', + 'neighbourhood': 'neighbourhood name', + 'locality': 'locality name', + 'localadmin': 'localadmin name', + 'county': 'county name', + 'macrocounty': 'macrocounty name', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'house number street name, locality name, region name, Australia'); + t.end(); + }); + + test('neighbourhood', function(t) { + var doc = { + 'name': 'neighbourhood name', + 'layer': 'neighbourhood', + 'neighbourhood': 'neighbourhood name', + 'locality': 'locality name', + 'localadmin': 'localadmin name', + 'county': 'county name', + 'macrocounty': 'macrocounty name', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'neighbourhood name, locality name, region name, Australia'); + t.end(); + }); + + test('locality', function(t) { + var doc = { + 'name': 'locality name', + 'layer': 'locality', + 'locality': 'locality name', + 'localadmin': 'localadmin name', + 'county': 'county name', + 'macrocounty': 'macrocounty name', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'locality name, region name, Australia'); + t.end(); + }); + + test('localadmin', function(t) { + var doc = { + 'name': 'localadmin name', + 'layer': 'localadmin', + 'localadmin': 'localadmin name', + 'county': 'county name', + 'macrocounty': 'macrocounty name', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'localadmin name, region name, Australia'); + t.end(); + }); + + test('county', function(t) { + var doc = { + 'name': 'county name', + 'layer': 'county', + 'county': 'county name', + 'macrocounty': 'macrocounty name', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'county name, region name, Australia'); + t.end(); + }); + + test('macrocounty', function(t) { + var doc = { + 'name': 'macrocounty name', + 'layer': 'macrocounty', + 'macrocounty': 'macrocounty name', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'macrocounty name, region name, Australia'); + t.end(); + }); + + test('region', function(t) { + var doc = { + 'name': 'region name', + 'layer': 'region', + 'region': 'region name', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'region name, Australia'); + t.end(); + }); + + test('macroregion', function(t) { + var doc = { + 'name': 'macroregion name', + 'layer': 'macroregion', + 'macroregion': 'macroregion name', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'macroregion name, Australia'); + t.end(); + }); + + test('country', function(t) { + var doc = { + 'name': 'Australia', + 'layer': 'country', + 'postalcode': 'postalcode', + 'country_a': 'AUS', + 'country': 'Australia' + }; + t.equal(generator(doc),'Australia'); + t.end(); + }); + +}; + +module.exports.all = function (tape, common) { + + function test(name, testFunction) { + return tape('label generator (AUS): ' + name, testFunction); + } + + for( var testCase in module.exports.tests ){ + module.exports.tests[testCase](test, common); + } +}; diff --git a/test/unit/helper/labelSchema.js b/test/unit/helper/labelSchema.js index 117fc42c..d18e7682 100644 --- a/test/unit/helper/labelSchema.js +++ b/test/unit/helper/labelSchema.js @@ -18,12 +18,14 @@ module.exports.tests.supported_countries = function(test, common) { t.notEquals(supported_countries.indexOf('USA'), -1); t.notEquals(supported_countries.indexOf('CAN'), -1); t.notEquals(supported_countries.indexOf('GBR'), -1); + t.notEquals(supported_countries.indexOf('AUS'), -1); t.notEquals(supported_countries.indexOf('default'), -1); - t.equals(supported_countries.length, 4); + t.equals(supported_countries.length, 5); t.equals(Object.keys(schemas.USA).length, 4); t.equals(Object.keys(schemas.CAN).length, 3); t.equals(Object.keys(schemas.GBR).length, 3); + t.equals(Object.keys(schemas.AUS).length, 3); t.equals(Object.keys(schemas.default).length, 2); t.end(); diff --git a/test/unit/run.js b/test/unit/run.js index d6c65b56..de8d770a 100644 --- a/test/unit/run.js +++ b/test/unit/run.js @@ -16,6 +16,7 @@ var tests = [ require('./helper/labelGenerator_examples'), require('./helper/labelGenerator_default'), require('./helper/labelGenerator_CAN'), + require('./helper/labelGenerator_AUS'), require('./helper/labelGenerator_GBR'), require('./helper/labelGenerator_USA'), require('./helper/labelSchema'), From 29c1255694cfcd2da2ae685a747390e1ba8ac80e Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Thu, 18 Aug 2016 20:58:58 -0400 Subject: [PATCH 4/8] added `dependency` fields to output --- helper/geojsonify_place_details.js | 3 +++ helper/placeTypes.js | 1 + test/unit/helper/geojsonify.js | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/helper/geojsonify_place_details.js b/helper/geojsonify_place_details.js index abaefe27..297ca3bd 100644 --- a/helper/geojsonify_place_details.js +++ b/helper/geojsonify_place_details.js @@ -12,6 +12,9 @@ var DETAILS_PROPS = [ { name: 'country', type: 'string' }, { name: 'country_gid', type: 'string' }, { name: 'country_a', type: 'string' }, + { name: 'dependency', type: 'string' }, + { name: 'dependency_gid', type: 'string' }, + { name: 'dependency_a', type: 'string' }, { name: 'macroregion', type: 'string' }, { name: 'macroregion_gid', type: 'string' }, { name: 'macroregion_a', type: 'string' }, diff --git a/helper/placeTypes.js b/helper/placeTypes.js index 76538982..c9550ce7 100644 --- a/helper/placeTypes.js +++ b/helper/placeTypes.js @@ -1,5 +1,6 @@ module.exports = [ 'country', + 'dependency', 'macroregion', 'region', 'macrocounty', diff --git a/test/unit/helper/geojsonify.js b/test/unit/helper/geojsonify.js index 00107af2..ef7da91e 100644 --- a/test/unit/helper/geojsonify.js +++ b/test/unit/helper/geojsonify.js @@ -58,6 +58,7 @@ module.exports.tests.geojsonify = function(test, common) { 'postalcode': 'N1 0RW', 'country_a': 'GBR', 'country': 'United Kingdom', + 'dependency': 'dependency name', 'region': 'Islington', 'region_a': 'ISL', 'macroregion': 'England', @@ -85,6 +86,7 @@ module.exports.tests.geojsonify = function(test, common) { }, 'country_a': 'GBR', 'country': 'United Kingdom', + 'dependency': 'dependency name', 'region': 'City And County Of The City Of London', 'region_a': 'COL', 'macroregion': 'England', @@ -108,6 +110,7 @@ module.exports.tests.geojsonify = function(test, common) { }, 'country_a': 'USA', 'country': 'United States', + 'dependency': 'dependency name', 'region': 'New York', 'region_a': 'NY', 'county': 'New York', @@ -144,6 +147,7 @@ module.exports.tests.geojsonify = function(test, common) { 'name': '\'Round Midnight Jazz and Blues Bar', 'country_a': 'GBR', 'country': 'United Kingdom', + 'dependency': 'dependency name', 'macroregion': 'England', 'region': 'Islington', 'region_a': 'ISL', @@ -179,6 +183,7 @@ module.exports.tests.geojsonify = function(test, common) { 'name': 'Blues Cafe', 'country_a': 'GBR', 'country': 'United Kingdom', + 'dependency': 'dependency name', 'macroregion': 'England', 'region': 'City And County Of The City Of London', 'region_a': 'COL', @@ -207,6 +212,7 @@ module.exports.tests.geojsonify = function(test, common) { 'name': 'Empire State Building', 'country_a': 'USA', 'country': 'United States', + 'dependency': 'dependency name', 'region': 'New York', 'region_a': 'NY', 'county': 'New York', @@ -267,6 +273,15 @@ module.exports.tests.geojsonify = function(test, common) { 'country_a': [ 'USA' ], + 'dependency': [ + 'dependency name' + ], + 'dependency_gid': [ + 'dependency id' + ], + 'dependency_a': [ + 'dependency abbrevation' + ], 'macroregion': [ 'MacroRegion Name' ], @@ -341,6 +356,9 @@ module.exports.tests.geojsonify = function(test, common) { 'country': 'United States', 'country_gid': '85633793', 'country_a': 'USA', + 'dependency': 'dependency name', + 'dependency_gid': 'dependency id', + 'dependency_a': 'dependency abbrevation', 'macroregion': 'MacroRegion Name', 'macroregion_gid': 'MacroRegion Id', 'macroregion_a': 'MacroRegion Abbreviation', From 63a6f230b0e0359823c09a34a22ad6764025f19a Mon Sep 17 00:00:00 2001 From: Alec Vulfson Date: Fri, 19 Aug 2016 12:57:56 -0400 Subject: [PATCH 5/8] Change name of function to be more general --- helper/labelSchema.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/helper/labelSchema.js b/helper/labelSchema.js index 5cd6024b..ec752b6e 100644 --- a/helper/labelSchema.js +++ b/helper/labelSchema.js @@ -13,17 +13,17 @@ module.exports = { 'USA': { 'borough': getFirstProperty(['borough']), 'local': getFirstProperty(['locality', 'localadmin', 'county']), - 'regional': getUsOrCaOrAusState, + 'regional': getRegionalValue, 'country': getUSACountryValue }, 'AUS': { 'local' : getFirstProperty(['locality', 'localadmin']), - 'regional' : getUsOrCaOrAusState, + 'regional' : getRegionalValue, 'country': getFirstProperty(['country']) }, 'CAN': { 'local': getFirstProperty(['locality']), // no localadmins in CAN - 'regional': getUsOrCaOrAusState, + 'regional': getRegionalValue, 'country': getFirstProperty(['country']) } }; @@ -44,12 +44,12 @@ function getFirstProperty(fields) { } -// this function is exclusively used for figuring out which field to use for US/CA States -// 1. if a US/CA state is the most granular bit of info entered, the label should contain -// the full state name, eg: Pennsylvania, USA and Ontario, CA -// 2. otherwise, the state abbreviation should be used, eg: Lancaster, PA, USA and Bruce, ON, CA -// 3. if for some reason the abbreviation isn't available, use the full state name -function getUsOrCaOrAusState(record) { +// this function is exclusively used for figuring out which field to use for states/provinces +// 1. if a state/province is the most granular bit of info entered, the label should contain +// the full state/province name, eg: Pennsylvania, USA and Ontario, CA +// 2. otherwise, the state/province abbreviation should be used, eg: Lancaster, PA, USA and Bruce, ON, CA +// 3. if the abbreviation isn't available, use the full state/province name +function getRegionalValue(record) { if ('region' === record.layer && record.region) { // return full state name when state is the most granular piece of info return record.region; From e53fcbc9d75b682bf7b7c46a8e6df6158b59dfa3 Mon Sep 17 00:00:00 2001 From: Patrick Mezard Date: Thu, 18 Aug 2016 09:03:04 +0200 Subject: [PATCH 6/8] test/ciao: update valid layers list in reference output --- test/ciao/autocomplete/layers_invalid.coffee | 2 +- test/ciao/autocomplete/layers_mix_invalid_valid.coffee | 2 +- test/ciao/reverse/layers_invalid.coffee | 2 +- test/ciao/reverse/layers_mix_invalid_valid.coffee | 2 +- test/ciao/search/layers_invalid.coffee | 2 +- test/ciao/search/layers_mix_invalid_valid.coffee | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/ciao/autocomplete/layers_invalid.coffee b/test/ciao/autocomplete/layers_invalid.coffee index 6f3cebe0..5e5431db 100644 --- a/test/ciao/autocomplete/layers_invalid.coffee +++ b/test/ciao/autocomplete/layers_invalid.coffee @@ -24,7 +24,7 @@ json.features.should.be.instanceof Array #? expected errors should.exist json.geocoding.errors -json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,region,county,locality,continent,dependency,macroregion,localadmin,macrocounty,macrohood,borough,neighbourhood,microhood,disputed' ] +json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,macroregion,region,county,localadmin,locality,borough,neighbourhood,continent,dependency,macrocounty,macrohood,microhood,disputed' ] #? expected warnings should.not.exist json.geocoding.warnings diff --git a/test/ciao/autocomplete/layers_mix_invalid_valid.coffee b/test/ciao/autocomplete/layers_mix_invalid_valid.coffee index a819dd44..a256e988 100644 --- a/test/ciao/autocomplete/layers_mix_invalid_valid.coffee +++ b/test/ciao/autocomplete/layers_mix_invalid_valid.coffee @@ -24,7 +24,7 @@ json.features.should.be.instanceof Array #? expected errors should.exist json.geocoding.errors -json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,region,county,locality,continent,dependency,macroregion,localadmin,macrocounty,macrohood,borough,neighbourhood,microhood,disputed' ] +json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,macroregion,region,county,localadmin,locality,borough,neighbourhood,continent,dependency,macrocounty,macrohood,microhood,disputed' ] #? expected warnings should.not.exist json.geocoding.warnings diff --git a/test/ciao/reverse/layers_invalid.coffee b/test/ciao/reverse/layers_invalid.coffee index bc57a3b3..f9e115f1 100644 --- a/test/ciao/reverse/layers_invalid.coffee +++ b/test/ciao/reverse/layers_invalid.coffee @@ -24,7 +24,7 @@ json.features.should.be.instanceof Array #? expected errors should.exist json.geocoding.errors -json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,region,county,locality,continent,dependency,macroregion,localadmin,macrocounty,macrohood,borough,neighbourhood,microhood,disputed' ] +json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,macroregion,region,county,localadmin,locality,borough,neighbourhood,continent,dependency,macrocounty,macrohood,microhood,disputed' ] #? expected warnings should.not.exist json.geocoding.warnings diff --git a/test/ciao/reverse/layers_mix_invalid_valid.coffee b/test/ciao/reverse/layers_mix_invalid_valid.coffee index 16f40b9e..6ef5b01b 100644 --- a/test/ciao/reverse/layers_mix_invalid_valid.coffee +++ b/test/ciao/reverse/layers_mix_invalid_valid.coffee @@ -24,7 +24,7 @@ json.features.should.be.instanceof Array #? expected errors should.exist json.geocoding.errors -json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,region,county,locality,continent,dependency,macroregion,localadmin,macrocounty,macrohood,borough,neighbourhood,microhood,disputed' ] +json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,macroregion,region,county,localadmin,locality,borough,neighbourhood,continent,dependency,macrocounty,macrohood,microhood,disputed' ] #? expected warnings should.not.exist json.geocoding.warnings diff --git a/test/ciao/search/layers_invalid.coffee b/test/ciao/search/layers_invalid.coffee index cc6feab8..dd8a72c7 100644 --- a/test/ciao/search/layers_invalid.coffee +++ b/test/ciao/search/layers_invalid.coffee @@ -24,7 +24,7 @@ json.features.should.be.instanceof Array #? expected errors should.exist json.geocoding.errors -json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,region,county,locality,continent,dependency,macroregion,localadmin,macrocounty,macrohood,borough,neighbourhood,microhood,disputed' ] +json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,macroregion,region,county,localadmin,locality,borough,neighbourhood,continent,dependency,macrocounty,macrohood,microhood,disputed' ] #? expected warnings should.not.exist json.geocoding.warnings diff --git a/test/ciao/search/layers_mix_invalid_valid.coffee b/test/ciao/search/layers_mix_invalid_valid.coffee index f332e051..06b5a4ee 100644 --- a/test/ciao/search/layers_mix_invalid_valid.coffee +++ b/test/ciao/search/layers_mix_invalid_valid.coffee @@ -24,7 +24,7 @@ json.features.should.be.instanceof Array #? expected errors should.exist json.geocoding.errors -json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,region,county,locality,continent,dependency,macroregion,localadmin,macrocounty,macrohood,borough,neighbourhood,microhood,disputed' ] +json.geocoding.errors.should.eql [ '\'notlayer\' is an invalid layers parameter. Valid options: coarse,address,venue,country,macroregion,region,county,localadmin,locality,borough,neighbourhood,continent,dependency,macrocounty,macrohood,microhood,disputed' ] #? expected warnings should.not.exist json.geocoding.warnings From 0f0cfd16d9bee0ac6b93abaa3e54664f1f48ea9c Mon Sep 17 00:00:00 2001 From: Patrick Mezard Date: Mon, 22 Aug 2016 21:52:54 +0200 Subject: [PATCH 7/8] test/ciao: fix inverted negative latitudes in tests See https://github.com/elastic/elasticsearch/issues/18458 --- test/ciao/search/boundary_rect_valid.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/ciao/search/boundary_rect_valid.coffee b/test/ciao/search/boundary_rect_valid.coffee index efb2cc4a..0d7b90fa 100644 --- a/test/ciao/search/boundary_rect_valid.coffee +++ b/test/ciao/search/boundary_rect_valid.coffee @@ -1,6 +1,6 @@ #> bounding rectangle -path: '/v1/search?text=a&boundary.rect.min_lat=-40.659&boundary.rect.max_lat=-41.614&boundary.rect.min_lon=174.612&boundary.rect.max_lon=176.333' +path: '/v1/search?text=a&boundary.rect.max_lat=-40.659&boundary.rect.min_lat=-41.614&boundary.rect.min_lon=174.612&boundary.rect.max_lon=176.333' #? 200 ok response.statusCode.should.be.equal 200 @@ -31,7 +31,7 @@ should.not.exist json.geocoding.warnings #? inputs json.geocoding.query['text'].should.eql 'a' json.geocoding.query['size'].should.eql 10 -json.geocoding.query['boundary.rect.min_lat'].should.eql -40.659 -json.geocoding.query['boundary.rect.max_lat'].should.eql -41.614 +json.geocoding.query['boundary.rect.min_lat'].should.eql -41.614 +json.geocoding.query['boundary.rect.max_lat'].should.eql -40.659 json.geocoding.query['boundary.rect.min_lon'].should.eql 174.612 -json.geocoding.query['boundary.rect.max_lon'].should.eql 176.333 \ No newline at end of file +json.geocoding.query['boundary.rect.max_lon'].should.eql 176.333 From 50475c616b0e6442e02e8fc9ec7715be8d1de616 Mon Sep 17 00:00:00 2001 From: Patrick Mezard Date: Mon, 22 Aug 2016 22:31:09 +0200 Subject: [PATCH 8/8] test/ciao: reverse learnt to handle circle at some point So fix the test pretending it does not. --- .../boundary_circle_invalid_radius.coffee | 14 +++++--------- .../reverse/boundary_circle_valid_radius.coffee | 16 ++++++---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/test/ciao/reverse/boundary_circle_invalid_radius.coffee b/test/ciao/reverse/boundary_circle_invalid_radius.coffee index cb257d4e..cc47292a 100644 --- a/test/ciao/reverse/boundary_circle_invalid_radius.coffee +++ b/test/ciao/reverse/boundary_circle_invalid_radius.coffee @@ -26,14 +26,10 @@ json.features.should.be.instanceof Array should.exist json.geocoding.errors json.geocoding.errors.should.eql [ 'missing param \'boundary.circle.radius\'' ] -#? expected warnings -should.exist json.geocoding.warnings -json.geocoding.warnings.should.eql [ 'boundary.circle is currently unsupported' ] - #? inputs # json.geocoding.query['size'].should.eql 10 -# json.geocoding.query['point.lat'].should.eql 40.744243 -# json.geocoding.query['point.lon'].should.eql -73.990342 -# json.geocoding.query['boundary.circle.lat'].should.eql 40.744243 -# json.geocoding.query['boundary.circle.lon'].should.eql -73.990342 -# should.not.exist json.geocoding.query['boundary.circle.radius'] +json.geocoding.query['point.lat'].should.eql 40.744243 +json.geocoding.query['point.lon'].should.eql -73.990342 +should.not.exist json.geocoding.query['boundary.circle.radius'] +should.not.exist json.geocoding.query['boundary.circle.lat'] +should.not.exist json.geocoding.query['boundary.circle.lon'] diff --git a/test/ciao/reverse/boundary_circle_valid_radius.coffee b/test/ciao/reverse/boundary_circle_valid_radius.coffee index 9279eb70..f4ef8f35 100644 --- a/test/ciao/reverse/boundary_circle_valid_radius.coffee +++ b/test/ciao/reverse/boundary_circle_valid_radius.coffee @@ -25,14 +25,10 @@ json.features.should.be.instanceof Array #? expected errors should.not.exist json.geocoding.errors -#? expected warnings -should.exist json.geocoding.warnings -json.geocoding.warnings.should.eql [ 'boundary.circle is currently unsupported' ] - #? inputs -# json.geocoding.query['size'].should.eql 10 -# json.geocoding.query['point.lat'].should.eql 40.744243 -# json.geocoding.query['point.lon'].should.eql -73.990342 -# json.geocoding.query['boundary.circle.lat'].should.eql 40.744243 -# json.geocoding.query['boundary.circle.lon'].should.eql -73.990342 -# json.geocoding.query['boundary.circle.radius'].should.eql 999.9 +json.geocoding.query['size'].should.eql 10 +json.geocoding.query['point.lat'].should.eql 40.744243 +json.geocoding.query['point.lon'].should.eql -73.990342 +json.geocoding.query['boundary.circle.lat'].should.eql 40.744243 +json.geocoding.query['boundary.circle.lon'].should.eql -73.990342 +json.geocoding.query['boundary.circle.radius'].should.eql 999.9