Browse Source

actually removed last of `sanitise` references

pull/679/head
Stephen Hess 8 years ago
parent
commit
a62581ddd6
  1. 2
      sanitizer/search_fallback.js
  2. 32
      test/unit/sanitizer/_text_addressit.js

2
sanitizer/search_fallback.js

@ -9,7 +9,7 @@ var logging = require( '../helper/logging' );
// middleware // middleware
module.exports.middleware = function( req, res, next ){ module.exports.middleware = function( req, res, next ){
// if res.data already has results then don't call the _text_autocomplete sanitiser // if res.data already has results then don't call the _text_autocomplete sanitizer
// this has been put into place for when the libpostal integration way of querying // this has been put into place for when the libpostal integration way of querying
// ES doesn't return anything and we want to fallback to the old logic // ES doesn't return anything and we want to fallback to the old logic
if (res && res.hasOwnProperty('data') && res.data.length > 0) { if (res && res.hasOwnProperty('data') && res.data.length > 0) {

32
test/unit/sanitizer/_text_addressit.js

@ -1,4 +1,4 @@
var sanitiser = require('../../../sanitizer/_text_addressit'); var sanitizer = require('../../../sanitizer/_text_addressit');
var type_mapping = require('../../../helper/type_mapping'); var type_mapping = require('../../../helper/type_mapping');
module.exports.tests = {}; module.exports.tests = {};
@ -11,7 +11,7 @@ module.exports.tests.text_parser = function(test, common) {
var clean = { var clean = {
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEquals(messages.errors, [], 'no errors'); t.deepEquals(messages.errors, [], 'no errors');
t.deepEquals(messages.warnings, [], 'no warnings'); t.deepEquals(messages.warnings, [], 'no warnings');
@ -41,7 +41,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -65,7 +65,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -95,7 +95,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -118,7 +118,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -139,7 +139,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'yugolsavia' text: 'yugolsavia'
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -158,7 +158,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'small town' text: 'small town'
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -177,7 +177,7 @@ module.exports.tests.text_parser = function(test, common) {
text: '123 main' text: '123 main'
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -196,7 +196,7 @@ module.exports.tests.text_parser = function(test, common) {
text: 'main 123' text: 'main 123'
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -219,7 +219,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -243,7 +243,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -268,7 +268,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -293,7 +293,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -318,7 +318,7 @@ module.exports.tests.text_parser = function(test, common) {
} }
}; };
var messages = sanitiser(raw, clean); var messages = sanitizer(raw, clean);
t.deepEqual(messages, { errors: [], warnings: [] } ); t.deepEqual(messages, { errors: [], warnings: [] } );
t.deepEqual(clean, expected_clean); t.deepEqual(clean, expected_clean);
@ -330,7 +330,7 @@ module.exports.tests.text_parser = function(test, common) {
module.exports.all = function (tape, common) { module.exports.all = function (tape, common) {
function test(name, testFunction) { function test(name, testFunction) {
return tape('SANITISER _text: ' + name, testFunction); return tape('sanitizeR _text: ' + name, testFunction);
} }
for( var testCase in module.exports.tests ){ for( var testCase in module.exports.tests ){

Loading…
Cancel
Save