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 // valid text
clean.text = raw.text; clean.text = raw.text;
// remove anything that may have been parsed before
delete clean.parsed_text;
// parse text with query parser // parse text with query parser
var parsed_text = parse(clean.text); var parsed_text = parse(clean.text);
if (check.assigned(parsed_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' text: 'yugolsavia'
}; };
var clean = {}; var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = { var expected_clean = {
text: 'yugolsavia' text: 'yugolsavia'
@ -97,6 +98,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'small town' text: 'small town'
}; };
var clean = {}; var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = { var expected_clean = {
text: 'small town' text: 'small town'
@ -115,6 +117,7 @@ module.exports.tests.text_parser = function(test, common) {
text: '123 main' text: '123 main'
}; };
var clean = {}; var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = { var expected_clean = {
text: '123 main' text: '123 main'
@ -133,6 +136,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'main 123' text: 'main 123'
}; };
var clean = {}; var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = { var expected_clean = {
text: 'main 123' text: 'main 123'
@ -151,6 +155,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'main particle new york' text: 'main particle new york'
}; };
var clean = {}; var clean = {};
clean.parsed_text = 'this should be removed';
var expected_clean = { var expected_clean = {
text: 'main particle new york' text: 'main particle new york'

Loading…
Cancel
Save