Browse Source

incorporated _private sanitizer into search endpoint

pull/248/head
Stephen Hess 9 years ago
parent
commit
a2b1579b3e
  1. 1
      sanitiser/search.js
  2. 27
      test/unit/sanitiser/search.js

1
sanitiser/search.js

@ -6,6 +6,7 @@ var _sanitize = require('../sanitiser/_sanitize'),
layers: require('../sanitiser/_layers'), layers: require('../sanitiser/_layers'),
source: require('../sanitiser/_source'), source: require('../sanitiser/_source'),
details: require('../sanitiser/_details'), details: require('../sanitiser/_details'),
private: require('../sanitiser/_private'),
latlonzoom: require('../sanitiser/_geo_search') latlonzoom: require('../sanitiser/_geo_search')
}; };

27
test/unit/sanitiser/search.js

@ -86,6 +86,33 @@ module.exports.tests.sanitize_text_with_delim = function(test, common) {
}); });
}; };
module.exports.tests.sanitize_private_no_value = function(test, common) {
test('default private should be set to true', function(t) {
sanitize({ text: 'test' }, function( err, clean ){
t.equal(clean.private, true, 'private set to true');
});
t.end();
});
};
module.exports.tests.sanitize_private_explicit_true_value = function(test, common) {
test('explicit private should be set to true', function(t) {
sanitize({ text: 'test', private: true }, function( err, clean ){
t.equal(clean.private, true, 'private set to true');
});
t.end();
});
};
module.exports.tests.sanitize_private_explicit_false_value = function(test, common) {
test('explicit private should be set to false', function(t) {
sanitize({ text: 'test', private: false }, function( err, clean ){
t.equal(clean.private, false, 'private set to false');
});
t.end();
});
};
module.exports.tests.sanitize_lat = function(test, common) { module.exports.tests.sanitize_lat = function(test, common) {
var lats = { var lats = {
invalid: [], invalid: [],

Loading…
Cancel
Save