From d1bb1fd944b880610f9e24978b32c87554245a71 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Wed, 9 Nov 2016 14:26:15 -0500 Subject: [PATCH] added borough support --- sanitizer/_synthesize_analysis.js | 4 ++-- test/unit/sanitizer/_synthesize_analysis.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sanitizer/_synthesize_analysis.js b/sanitizer/_synthesize_analysis.js index f332ca1b..1717fd74 100644 --- a/sanitizer/_synthesize_analysis.js +++ b/sanitizer/_synthesize_analysis.js @@ -1,6 +1,6 @@ const _ = require('lodash'); -const fields = ['query', 'address', 'neighbourhood', 'city', +const fields = ['query', 'address', 'neighbourhood', 'borough', 'city', 'county', 'state', 'postalcode', 'country']; function normalizeWhitespaceToSingleSpace(val) { @@ -24,7 +24,7 @@ function sanitize( raw, clean ){ if (_.isEmpty(Object.keys(clean.parsed_text))) { messages.errors.push('at least one of the following fields is required: ' + - 'query, address, neighbourhood, city, county, state, postalcode, country'); + 'query, address, neighbourhood, borough, city, county, state, postalcode, country'); } return messages; diff --git a/test/unit/sanitizer/_synthesize_analysis.js b/test/unit/sanitizer/_synthesize_analysis.js index 7bfc52dd..b2e5915b 100644 --- a/test/unit/sanitizer/_synthesize_analysis.js +++ b/test/unit/sanitizer/_synthesize_analysis.js @@ -9,6 +9,7 @@ module.exports.tests.text_parser = function(test, common) { query: ' \t query \t value \t ', address: ' \t address \t value \t ', neighbourhood: ' \t neighbourhood \t value \t ', + borough: ' \t borough \t value \t ', city: ' \t city \t value \t ', county: ' \t county \t value \t ', state: ' \t state \t value \t ', @@ -23,6 +24,7 @@ module.exports.tests.text_parser = function(test, common) { query: 'query value', address: 'address value', neighbourhood: 'neighbourhood value', + borough: 'borough value', city: 'city value', county: 'county value', state: 'state value', @@ -50,6 +52,7 @@ module.exports.tests.text_parser = function(test, common) { query: getInvalidValue(), address: getInvalidValue(), neighbourhood: getInvalidValue(), + borough: getInvalidValue(), city: getInvalidValue(), county: getInvalidValue(), state: getInvalidValue(), @@ -67,7 +70,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, city, county, state, postalcode, country'], 'no errors'); + 'query, address, neighbourhood, borough, city, county, state, postalcode, country'], 'no errors'); t.deepEquals(messages.warnings, [], 'no warnings'); t.end(); @@ -84,7 +87,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, city, county, state, postalcode, country'], 'no errors'); + 'query, address, neighbourhood, borough, city, county, state, postalcode, country'], 'no errors'); t.deepEquals(messages.warnings, [], 'no warnings'); t.end();