Browse Source

remove exporting sanitize for testing

pull/942/head
Lily He 7 years ago
parent
commit
db56ce45c3
  1. 6
      sanitizer/nearby.js
  2. 6
      sanitizer/place.js
  3. 6
      sanitizer/reverse.js
  4. 4
      test/unit/sanitizer/sanitizeAll.js

6
sanitizer/nearby.js

@ -17,12 +17,6 @@ var sanitizers = {
categories: require('../sanitizer/_categories')()
};
var sanitize = sanitizeAll.runAllChecks;
// export sanitize for testing
module.exports.sanitize = sanitize;
module.exports.sanitizer_list = sanitizers;
// middleware
module.exports.middleware = function( req, res, next ){
sanitizeAll.runAllChecks(req, sanitizers);

6
sanitizer/place.js

@ -6,12 +6,6 @@ var sanitizeAll = require('../sanitizer/sanitizeAll'),
private: require('../sanitizer/_flag_bool')('private', false)
};
var sanitize = sanitizeAll.runAllChecks;
// export sanitize for testing
module.exports.sanitize = sanitize;
module.exports.sanitizer_list = sanitizers;
// middleware
module.exports.middleware = function(req, res, next){
sanitizeAll.runAllChecks(req, sanitizers);

6
sanitizer/reverse.js

@ -15,12 +15,6 @@ var sanitizeAll = require('../sanitizer/sanitizeAll'),
boundary_country: require('../sanitizer/_boundary_country')()
};
var sanitize = sanitizeAll.runAllChecks;
// export sanitize for testing
module.exports.sanitize = sanitize;
module.exports.sanitizer_list = sanitizers;
// middleware
module.exports.middleware = function( req, res, next ){
sanitizeAll.runAllChecks(req, sanitizers);

4
test/unit/sanitizer/sanitizeAll.js

@ -152,7 +152,7 @@ module.exports.tests.all = function(test, common) {
t.end();
});
test('unexpected parameters should throw warning', function(t) {
test('unexpected parameters should add warning', function(t) {
var req = {
query: {
unknown_value: 'query value'
@ -177,7 +177,7 @@ module.exports.tests.all = function(test, common) {
t.end();
});
test('expected parameters should not throw warning', function(t) {
test('expected parameters should not add warning', function(t) {
var req = {
query: {
value: 'query value'

Loading…
Cancel
Save