Browse Source

testing: add test case: incorrect parsing of diagonal directionals - no subsequent element

libpostal_aus_unit_numbers
Peter Johnson 6 years ago
parent
commit
eabbd17f1c
  1. 43
      test/unit/controller/libpostal.js

43
test/unit/controller/libpostal.js

@ -357,6 +357,49 @@ module.exports.tests.bug_fixes = (test, common) => {
}); });
test('bug fix: incorrect parsing of diagonal directionals - no subsequent element', t => {
const service = (req, callback) => {
const response = [
{
'label': 'test',
'value': 'test'
},
{
'label': 'road',
'value': 'nw'
}
];
callback(null, response);
};
const controller = libpostal(service, () => true);
const req = {
clean: {
text: 'original query'
},
errors: []
};
controller(req, undefined, () => {
t.deepEquals(req, {
clean: {
text: 'original query',
parser: 'libpostal',
parsed_text: {
street: 'nw'
}
},
errors: []
}, 'req should not have been modified');
t.end();
});
});
test('bug fix: recast label for "zoo" from borough/city_district to house', t => { test('bug fix: recast label for "zoo" from borough/city_district to house', t => {
const service = (req, callback) => { const service = (req, callback) => {
const response = [ const response = [

Loading…
Cancel
Save