From da074639995f9a1c53b0f25f1efcb4591495d6d0 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Mon, 9 Oct 2017 15:42:04 -0400 Subject: [PATCH] set req.clean.parser to 'libpostal' when it's called --- controller/libpostal.js | 1 + test/unit/controller/libpostal.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/controller/libpostal.js b/controller/libpostal.js index 8f275dd9..23c82f85 100644 --- a/controller/libpostal.js +++ b/controller/libpostal.js @@ -20,6 +20,7 @@ function setup(should_execute) { parsed_text.country = iso3166.to3(_.toUpper(parsed_text.country)); } + req.clean.parser = 'libpostal'; req.clean.parsed_text = parsed_text; debugLog.push(req, {parsed_text: req.clean.parsed_text}); } diff --git a/test/unit/controller/libpostal.js b/test/unit/controller/libpostal.js index e0d012a9..f117007d 100644 --- a/test/unit/controller/libpostal.js +++ b/test/unit/controller/libpostal.js @@ -149,6 +149,7 @@ module.exports.tests.parse_is_called = (test, common) => { controller(req, res, () => { t.deepEquals(req, { clean: { + parser: 'libpostal', parsed_text: 'replacement parsed_text' } }); @@ -184,6 +185,7 @@ module.exports.tests.iso2_conversion = (test, common) => { controller(req, res, () => { t.deepEquals(req, { clean: { + parser: 'libpostal', parsed_text: { locality: 'this is the locality' } @@ -223,6 +225,7 @@ module.exports.tests.iso2_conversion = (test, common) => { controller(req, res, () => { t.deepEquals(req, { clean: { + parser: 'libpostal', parsed_text: { country: 'unknown country code' } @@ -265,6 +268,7 @@ module.exports.tests.iso2_conversion = (test, common) => { controller(req, res, () => { t.deepEquals(req, { clean: { + parser: 'libpostal', parsed_text: { country: 'ISO3 COUNTRY CODE' }