From 16fc3bee6680268bf99d5170ecd0db062080919b Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Thu, 8 Dec 2016 09:25:56 -0500 Subject: [PATCH 1/7] synthesize query value from parameter --- sanitizer/_synthesize_analysis.js | 1 + test/unit/sanitizer/_synthesize_analysis.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sanitizer/_synthesize_analysis.js b/sanitizer/_synthesize_analysis.js index ab18b581..722038be 100644 --- a/sanitizer/_synthesize_analysis.js +++ b/sanitizer/_synthesize_analysis.js @@ -2,6 +2,7 @@ const _ = require('lodash'); const text_analyzer = require('pelias-text-analyzer'); const fields = { + 'query': 'query', 'address': 'address', 'neighbourhood': 'neighbourhood', 'borough': 'borough', diff --git a/test/unit/sanitizer/_synthesize_analysis.js b/test/unit/sanitizer/_synthesize_analysis.js index dabacef8..7ca374c3 100644 --- a/test/unit/sanitizer/_synthesize_analysis.js +++ b/test/unit/sanitizer/_synthesize_analysis.js @@ -26,6 +26,7 @@ module.exports.tests.text_parser = function(test, common) { const expected_clean = { parsed_text: { + query: 'query value', neighbourhood: 'neighbourhood value', borough: 'borough value', city: 'locality value', @@ -58,6 +59,7 @@ module.exports.tests.text_parser = function(test, common) { } const raw = { + query: getInvalidValue(), address: getInvalidValue(), neighbourhood: getInvalidValue(), borough: getInvalidValue(), @@ -78,7 +80,7 @@ module.exports.tests.text_parser = function(test, common) { t.deepEquals(clean, expected_clean); t.deepEquals(messages.errors, ['at least one of the following fields is required: ' + - 'address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); + 'query, address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); t.deepEquals(messages.warnings, [], 'no warnings'); t.end(); @@ -101,7 +103,7 @@ module.exports.tests.text_parser = function(test, common) { t.deepEquals(clean, expected_clean); t.deepEquals(messages.errors, ['at least one of the following fields is required: ' + - 'address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); + 'query, address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); t.deepEquals(messages.warnings, [], 'no warnings'); t.end(); From 8c896695d19468c7d25ab6bdabf9cb6162623fbf Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Fri, 9 Dec 2016 15:16:38 -0500 Subject: [PATCH 2/7] tied query version to specific hash, updated tests --- package.json | 2 +- .../structured_geocoding/fallback.json | 89 +++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9059f0a9..4bd39d62 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "pelias-labels": "1.5.1", "pelias-logger": "0.1.0", "pelias-model": "4.4.0", - "pelias-query": "8.11.0", + "pelias-query": "pelias/query#b3e2ef7", "pelias-text-analyzer": "1.7.0", "stats-lite": "2.0.3", "through2": "^2.0.3" diff --git a/test/unit/fixture/structured_geocoding/fallback.json b/test/unit/fixture/structured_geocoding/fallback.json index a957b72c..6bea84fc 100644 --- a/test/unit/fixture/structured_geocoding/fallback.json +++ b/test/unit/fixture/structured_geocoding/fallback.json @@ -6,6 +6,95 @@ "query": { "bool": { "should": [ + { + "bool": { + "_name": "fallback.venue", + "must": [ + { + "multi_match": { + "query": "query value", + "type": "phrase", + "fields": [ + "phrase.default" + ] + } + }, + { + "multi_match": { + "query": "neighbourhood value", + "type": "phrase", + "fields": [ + "parent.neighbourhood", + "parent.neighbourhood_a" + ] + } + }, + { + "multi_match": { + "query": "borough value", + "type": "phrase", + "fields": [ + "parent.borough", + "parent.borough_a" + ] + } + }, + { + "multi_match": { + "query": "city value", + "type": "phrase", + "fields": [ + "parent.locality", + "parent.locality_a", + "parent.localadmin", + "parent.localadmin_a" + ] + } + }, + { + "multi_match": { + "query": "county value", + "type": "phrase", + "fields": [ + "parent.county", + "parent.county_a", + "parent.macrocounty", + "parent.macrocounty_a" + ] + } + }, + { + "multi_match": { + "query": "state value", + "type": "phrase", + "fields": [ + "parent.region", + "parent.region_a", + "parent.macroregion", + "parent.macroregion_a" + ] + } + }, + { + "multi_match": { + "query": "country value", + "type": "phrase", + "fields": [ + "parent.country", + "parent.country_a", + "parent.dependency", + "parent.dependency_a" + ] + } + } + ], + "filter": { + "term": { + "layer": "venue" + } + } + } + }, { "bool": { "_name": "fallback.address", From bb285cf0a56df10004a2f4dbbb4953565d5b27c2 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Fri, 9 Dec 2016 17:20:03 -0500 Subject: [PATCH 3/7] bumped query hash, updated test --- package.json | 2 +- test/unit/fixture/structured_geocoding/fallback.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4bd39d62..9b4af449 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "pelias-labels": "1.5.1", "pelias-logger": "0.1.0", "pelias-model": "4.4.0", - "pelias-query": "pelias/query#b3e2ef7", + "pelias-query": "pelias/query#fe42de6", "pelias-text-analyzer": "1.7.0", "stats-lite": "2.0.3", "through2": "^2.0.3" diff --git a/test/unit/fixture/structured_geocoding/fallback.json b/test/unit/fixture/structured_geocoding/fallback.json index 6bea84fc..cd12a864 100644 --- a/test/unit/fixture/structured_geocoding/fallback.json +++ b/test/unit/fixture/structured_geocoding/fallback.json @@ -15,7 +15,8 @@ "query": "query value", "type": "phrase", "fields": [ - "phrase.default" + "phrase.default", + "category" ] } }, From 5a146d2efea7673bd004b20d02cd6884cf425b2a Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Fri, 16 Dec 2016 16:49:53 -0500 Subject: [PATCH 4/7] bumped query package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b4af449..055f7c61 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "pelias-labels": "1.5.1", "pelias-logger": "0.1.0", "pelias-model": "4.4.0", - "pelias-query": "pelias/query#fe42de6", + "pelias-query": "8.12.0", "pelias-text-analyzer": "1.7.0", "stats-lite": "2.0.3", "through2": "^2.0.3" From abb4fa6113f0ef4b4b8595223b4df0075bcc0278 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Thu, 17 Nov 2016 17:22:04 -0500 Subject: [PATCH 5/7] Adjust autocomplete focus boost This lowers the autocomplete focus boost from 40 to 15. The idea is that, because the boost for population is 20, the focus can't possibly override a popular city, but it can come close. On our default dev build, no acceptance tests fail but the san francisco autocomplete test now passes! It's not clear if this fixes WOF venue issues yet, since the latest build there failed :( --- query/autocomplete_defaults.js | 2 +- test/unit/fixture/autocomplete_linguistic_focus.js | 2 +- test/unit/fixture/autocomplete_linguistic_focus_null_island.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/query/autocomplete_defaults.js b/query/autocomplete_defaults.js index 2800141b..34f396ae 100644 --- a/query/autocomplete_defaults.js +++ b/query/autocomplete_defaults.js @@ -31,7 +31,7 @@ module.exports = _.merge({}, peliasQuery.defaults, { 'focus:offset': '0km', 'focus:scale': '250km', 'focus:decay': 0.5, - 'focus:weight': 40, + 'focus:weight': 15, 'function_score:score_mode': 'avg', 'function_score:boost_mode': 'replace', diff --git a/test/unit/fixture/autocomplete_linguistic_focus.js b/test/unit/fixture/autocomplete_linguistic_focus.js index 07c741d7..d6aa0aa7 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus.js +++ b/test/unit/fixture/autocomplete_linguistic_focus.js @@ -44,7 +44,7 @@ module.exports = { 'decay': 0.5 } }, - 'weight': 40 + 'weight': 15 }], 'score_mode': 'avg', 'boost_mode': 'replace', diff --git a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js index b0761f40..8dd3f1e6 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js +++ b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js @@ -44,7 +44,7 @@ module.exports = { 'decay': 0.5 } }, - 'weight': 40 + 'weight': 15 }], 'score_mode': 'avg', 'boost_mode': 'replace', From d8cffe4b9bc0c1e9a52c070e60bc456fa3d823a5 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Wed, 4 Jan 2017 11:05:48 -0500 Subject: [PATCH 6/7] added configuration validation + tests --- app.js | 12 +- package.json | 1 + src/configValidation.js | 44 +++ test/unit/app.js | 35 +++ test/unit/run.js | 2 + test/unit/src/configValidation.js | 434 ++++++++++++++++++++++++++++++ 6 files changed, 523 insertions(+), 5 deletions(-) create mode 100644 src/configValidation.js create mode 100644 test/unit/app.js create mode 100644 test/unit/src/configValidation.js diff --git a/app.js b/app.js index 25573573..2dabb3c9 100644 --- a/app.js +++ b/app.js @@ -1,11 +1,13 @@ var app = require('express')(); -var peliasConfig = require( 'pelias-config' ).generate().api; +var peliasConfig = require( 'pelias-config' ).generate(); +// validate the configuration before attempting to load the app +require('./src/configValidation').validate(peliasConfig); -if( peliasConfig.accessLog ){ - app.use( require( './middleware/access_log' ).createAccessLogger( peliasConfig.accessLog ) ); +if( peliasConfig.api.accessLog ){ + app.use( require( './middleware/access_log' ).createAccessLogger( peliasConfig.api.accessLog ) ); } /** ----------------------- pre-processing-middleware ----------------------- **/ @@ -18,10 +20,10 @@ app.use( require('./middleware/jsonp') ); /** ----------------------- routes ----------------------- **/ var legacy = require('./routes/legacy'); -legacy.addRoutes(app, peliasConfig); +legacy.addRoutes(app, peliasConfig.api); var v1 = require('./routes/v1'); -v1.addRoutes(app, peliasConfig); +v1.addRoutes(app, peliasConfig.api); /** ----------------------- error middleware ----------------------- **/ diff --git a/package.json b/package.json index 9059f0a9..08549887 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "geolib": "^2.0.18", "geopipes-elasticsearch-backend": "^0.2.0", "iso3166-1": "^0.2.3", + "joi": "^10.1.0", "lodash": "^4.5.0", "markdown": "0.5.0", "morgan": "1.7.0", diff --git a/src/configValidation.js b/src/configValidation.js new file mode 100644 index 00000000..621f883b --- /dev/null +++ b/src/configValidation.js @@ -0,0 +1,44 @@ +'use strict'; + +const Joi = require('joi'); + +// Schema Configuration +// required: +// * api.version (string) +// * api.indexName (string) +// * api.host (string) +// * esclient (object - positive integer requestTimeout) +// +// optional: +// * api.accessLog (string) +// * api.relativeScores (boolean) +// * api.legacyUrl (string) +// * api.localization (flipNumberAndStreetCountries is array of 3 character strings) +const schema = Joi.object().keys({ + api: Joi.object().keys({ + version: Joi.string(), + indexName: Joi.string(), + host: Joi.string(), + legacyUrl: Joi.string(), + accessLog: Joi.string(), + relativeScores: Joi.boolean(), + localization: Joi.object().keys({ + flipNumberAndStreetCountries: Joi.array().items(Joi.string().regex(/^[A-Z]{3}$/)) + }).unknown(false) + + }).requiredKeys('version', 'indexName', 'host').unknown(true), + esclient: Joi.object().keys({ + requestTimeout: Joi.number().integer().min(0) + }).unknown(true) +}).requiredKeys('api', 'esclient').unknown(true); + +module.exports = { + validate: function validate(config) { + Joi.validate(config, schema, (err) => { + if (err) { + throw new Error(err.details[0].message); + } + }); + } + +}; diff --git a/test/unit/app.js b/test/unit/app.js new file mode 100644 index 00000000..58ac8cdb --- /dev/null +++ b/test/unit/app.js @@ -0,0 +1,35 @@ +'use strict'; + +const proxyquire = require('proxyquire').noCallThru(); + +module.exports.tests = {}; + +module.exports.tests.invalid_configuration = function(test, common) { + test('configuration validation throwing error should rethrow', function(t) { + t.throws(function() { + proxyquire('../../app', { + './src/configValidation': { + validate: () => { + throw Error('config is not valid'); + } + } + }); + + }, /config is not valid/); + + t.end(); + + }); + +}; + +module.exports.all = function (tape, common) { + + function test(name, testFunction) { + return tape('app: ' + name, testFunction); + } + + for( var testCase in module.exports.tests ){ + module.exports.tests[testCase](test, common); + } +}; diff --git a/test/unit/run.js b/test/unit/run.js index d21890e7..017492b5 100644 --- a/test/unit/run.js +++ b/test/unit/run.js @@ -9,6 +9,7 @@ var common = { }; var tests = [ + require('./app'), require('./controller/index'), require('./controller/place'), require('./controller/search'), @@ -61,6 +62,7 @@ var tests = [ require('./sanitizer/_categories'), require('./sanitizer/nearby'), require('./src/backend'), + require('./src/configValidation'), require('./sanitizer/autocomplete'), require('./sanitizer/structured_geocoding'), require('./sanitizer/place'), diff --git a/test/unit/src/configValidation.js b/test/unit/src/configValidation.js new file mode 100644 index 00000000..91b34312 --- /dev/null +++ b/test/unit/src/configValidation.js @@ -0,0 +1,434 @@ +'use strict'; + +const configValidation = require('../../../src/configValidation'); + +module.exports.tests = {}; + +module.exports.tests.completely_valid = function(test, common) { + test('all valid configuration elements should not throw error', function(t) { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + legacyUrl: 'legacyUrl value', + accessLog: 'accessLog value', + relativeScores: true, + localization: { + flipNumberAndStreetCountries: ['ABC', 'DEF'] + } + }, + esclient: { + requestTimeout: 17 + } + }; + + t.doesNotThrow(function() { + configValidation.validate(config); + }); + + t.end(); + + }); + + test('basic valid configurtaion should not throw error', function(t) { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value' + }, + esclient: { + requestTimeout: 17 + } + }; + + t.doesNotThrow(function() { + configValidation.validate(config); + }); + + t.end(); + + }); + +}; + +module.exports.tests.api_validation = function(test, common) { + test('config without api should throw error', function(t) { + var config = { + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"api" is required/, 'api should exist'); + t.end(); + + }); + + test('config without unknown field in api should not throw error', function(t) { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + unknown: 'unknown value' + }, + esclient: {} + }; + + t.doesNotThrow(function() { + configValidation.validate(config); + }, 'unknown properties should be allowed'); + t.end(); + + }); + + test('non-string api.version should throw error', function(t) { + [null, 17, {}, [], true].forEach((value) => { + var config = { + api: { + version: value, + indexName: 'index name value', + host: 'host value' + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"version" must be a string/); + }); + + t.end(); + + }); + + test('non-string api.indexName should throw error', function(t) { + [null, 17, {}, [], true].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: value, + host: 'host value' + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"indexName" must be a string/); + }); + + t.end(); + + }); + + test('non-string api.host should throw error', function(t) { + [null, 17, {}, [], true].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: value + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"host" must be a string/); + }); + + t.end(); + + }); + + test('non-string api.legacyUrl should throw error', function(t) { + [null, 17, {}, [], true].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + legacyUrl: value + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"legacyUrl" must be a string/); + }); + + t.end(); + + }); + + test('non-string api.accessLog should throw error', function(t) { + [null, 17, {}, [], true].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + accessLog: value + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"accessLog" must be a string/); + }); + + t.end(); + + }); + + test('non-boolean api.relativeScores should throw error', function(t) { + [null, 17, {}, [], 'string'].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + relativeScores: value + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"relativeScores" must be a boolean/); + }); + + t.end(); + + }); + + test('non-object api.localization should throw error', function(t) { + [null, 17, false, [], 'string'].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + localization: value + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"localization" must be an object/); + }); + + t.end(); + + }); + + test('unknown properties in api.localization should throw error', function(t) { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + localization: { + unknown_property: 'value' + } + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"unknown_property" is not allowed/); + + t.end(); + + }); + + test('non-array api.localization.flipNumberAndStreetCountries should throw error', function(t) { + [null, 17, {}, false, 'string'].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + localization: { + flipNumberAndStreetCountries: value + } + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"flipNumberAndStreetCountries" must be an array/); + }); + + t.end(); + + }); + + test('non-string api.localization.flipNumberAndStreetCountries elements should throw error', function(t) { + [null, 17, {}, false, []].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + localization: { + flipNumberAndStreetCountries: [value] + } + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /"0" must be a string/); + }); + + t.end(); + + }); + + test('non-3-char api.localization.flipNumberAndStreetCountries elements should throw error', function(t) { + ['AB', 'ABCD'].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value', + localization: { + flipNumberAndStreetCountries: [value] + } + }, + esclient: {} + }; + + t.throws(function() { + configValidation.validate(config); + }, /fails to match the required pattern/); + }); + + t.end(); + + }); + +}; + +module.exports.tests.esclient_validation = function(test, common) { + test('config without esclient should throw error', function(t) { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value' + } + }; + + t.throws(function() { + configValidation.validate(config); + }, /"esclient" is required/, 'esclient should exist'); + t.end(); + + }); + + test('config with non-object esclient should throw error', function(t) { + [null, 17, [], 'string', true].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value' + }, + esclient: value + }; + + t.throws(function() { + configValidation.validate(config); + }, /"esclient" must be an object/, 'esclient should be an object'); + + }); + + t.end(); + + }); + + test('config with non-integer esclient.requestTimeout should throw error', function(t) { + [null, 'string', {}, [], false].forEach((value) => { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value' + }, + esclient: { + requestTimeout: value + } + }; + + t.throws(function() { + configValidation.validate(config); + }, /"requestTimeout" must be a number/, 'esclient.requestTimeout should be a number'); + }); + + t.end(); + + }); + + test('config with non-integer esclient.requestTimeout should throw error', function(t) { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value' + }, + esclient: { + requestTimeout: 17.3 + } + }; + + t.throws(function() { + configValidation.validate(config); + }, /"requestTimeout" must be an integer/, 'esclient.requestTimeout should be an integer'); + + t.end(); + + }); + + test('config with negative esclient.requestTimeout should throw error', function(t) { + var config = { + api: { + version: 'version value', + indexName: 'index name value', + host: 'host value' + }, + esclient: { + requestTimeout: -1 + } + }; + + t.throws(function() { + configValidation.validate(config); + }, /"requestTimeout" must be larger than or equal to 0/, 'esclient.requestTimeout must be positive'); + + t.end(); + + }); + +}; + +module.exports.all = function (tape, common) { + + function test(name, testFunction) { + return tape('configValidation: ' + name, testFunction); + } + + for( var testCase in module.exports.tests ){ + module.exports.tests[testCase](test, common); + } +}; From 992f2455d5c73ee80c54633e538aca60fb7df836 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Thu, 12 Jan 2017 15:36:04 -0500 Subject: [PATCH 7/7] renamed `query` parameter to `venue` --- sanitizer/_synthesize_analysis.js | 2 +- test/unit/sanitizer/_synthesize_analysis.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sanitizer/_synthesize_analysis.js b/sanitizer/_synthesize_analysis.js index 722038be..f26dfc6a 100644 --- a/sanitizer/_synthesize_analysis.js +++ b/sanitizer/_synthesize_analysis.js @@ -2,7 +2,7 @@ const _ = require('lodash'); const text_analyzer = require('pelias-text-analyzer'); const fields = { - 'query': 'query', + 'venue': 'query', 'address': 'address', 'neighbourhood': 'neighbourhood', 'borough': 'borough', diff --git a/test/unit/sanitizer/_synthesize_analysis.js b/test/unit/sanitizer/_synthesize_analysis.js index 7ca374c3..97d49b2a 100644 --- a/test/unit/sanitizer/_synthesize_analysis.js +++ b/test/unit/sanitizer/_synthesize_analysis.js @@ -12,7 +12,7 @@ module.exports.tests.text_parser = function(test, common) { }}); const raw = { - query: ' \t query \t value \t ', + venue: ' \t venue \t value \t ', neighbourhood: ' \t neighbourhood \t value \t ', borough: ' \t borough \t value \t ', locality: ' \t locality \t value \t ', @@ -26,7 +26,7 @@ module.exports.tests.text_parser = function(test, common) { const expected_clean = { parsed_text: { - query: 'query value', + query: 'venue value', neighbourhood: 'neighbourhood value', borough: 'borough value', city: 'locality value', @@ -59,7 +59,7 @@ module.exports.tests.text_parser = function(test, common) { } const raw = { - query: getInvalidValue(), + venue: getInvalidValue(), address: getInvalidValue(), neighbourhood: getInvalidValue(), borough: getInvalidValue(), @@ -80,7 +80,7 @@ module.exports.tests.text_parser = function(test, common) { t.deepEquals(clean, expected_clean); t.deepEquals(messages.errors, ['at least one of the following fields is required: ' + - 'query, address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); + 'venue, address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); t.deepEquals(messages.warnings, [], 'no warnings'); t.end(); @@ -103,7 +103,7 @@ module.exports.tests.text_parser = function(test, common) { t.deepEquals(clean, expected_clean); t.deepEquals(messages.errors, ['at least one of the following fields is required: ' + - 'query, address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); + 'venue, address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); t.deepEquals(messages.warnings, [], 'no warnings'); t.end();