Browse Source

Merge pull request #1017 from pelias/set-libpostal-as-parser

set req.clean.parser to 'libpostal' when it's called
pull/1022/head
Stephen K Hess 7 years ago committed by GitHub
parent
commit
e6d9188599
  1. 1
      controller/libpostal.js
  2. 4
      test/unit/controller/libpostal.js

1
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});
}

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

Loading…
Cancel
Save