Browse Source

delete `clean.parsed_text` if falling back to addressit

pull/666/head
Stephen Hess 8 years ago
parent
commit
768843b0fb
  1. 3
      sanitiser/_text_addressit.js
  2. 5
      test/unit/sanitiser/_text_addressit.js

3
sanitiser/_text_addressit.js

@ -21,6 +21,9 @@ function sanitize( raw, clean ){
// valid text
clean.text = raw.text;
// remove anything that may have been parsed before
delete clean.parsed_text;
// parse text with query parser
var parsed_text = parse(clean.text);
if (check.assigned(parsed_text)) {

5
test/unit/sanitiser/_text_addressit.js

@ -79,6 +79,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'yugolsavia'
};
var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = {
text: 'yugolsavia'
@ -97,6 +98,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'small town'
};
var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = {
text: 'small town'
@ -115,6 +117,7 @@ module.exports.tests.text_parser = function(test, common) {
text: '123 main'
};
var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = {
text: '123 main'
@ -133,6 +136,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'main 123'
};
var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = {
text: 'main 123'
@ -151,6 +155,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'main particle new york'
};
var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = {
text: 'main particle new york'

Loading…
Cancel
Save