diff --git a/helper/geojsonify.js b/helper/geojsonify.js index 18e11b3d..9ce77ad4 100644 --- a/helper/geojsonify.js +++ b/helper/geojsonify.js @@ -8,7 +8,6 @@ var GeoJSON = require('geojson'), var DETAILS_PROPS = [ 'housenumber', 'street', - 'category', 'postalcode', 'country_a', 'country', diff --git a/sanitiser/reverse.js b/sanitiser/reverse.js index 49c93f2e..25e8d71b 100644 --- a/sanitiser/reverse.js +++ b/sanitiser/reverse.js @@ -6,7 +6,6 @@ var sanitizeAll = require('../sanitiser/sanitizeAll'), size: require('../sanitiser/_size'), private: require('../sanitiser/_flag_bool')('private', false), geo_reverse: require('../sanitiser/_geo_reverse'), - categories: require('../sanitiser/_categories'), boundary_country: require('../sanitiser/_boundary_country'), }; diff --git a/sanitiser/search.js b/sanitiser/search.js index ded714b4..22737180 100644 --- a/sanitiser/search.js +++ b/sanitiser/search.js @@ -7,7 +7,6 @@ var sanitizeAll = require('../sanitiser/sanitizeAll'), sources: require('../sanitiser/_targets')('sources', require( '../query/sources' )), private: require('../sanitiser/_flag_bool')('private', false), geo_search: require('../sanitiser/_geo_search'), - categories: require('../sanitiser/_categories'), boundary_country: require('../sanitiser/_boundary_country'), }; diff --git a/test/unit/helper/geojsonify.js b/test/unit/helper/geojsonify.js index 838dc526..9ed4ed0a 100644 --- a/test/unit/helper/geojsonify.js +++ b/test/unit/helper/geojsonify.js @@ -153,7 +153,6 @@ module.exports.tests.search = function(test, common) { 'localadmin': 'test1', 'locality': 'test2', 'neighbourhood': 'test3', - 'category': ['food', 'nightlife'], 'housenumber': '13', 'street': 'Liverpool Road', 'postalcode': 'N1 0RW' @@ -206,8 +205,7 @@ module.exports.tests.search = function(test, common) { 'county': 'New York', 'localadmin': 'Manhattan', 'locality': 'New York', - 'neighbourhood': 'Koreatown', - 'category': ['tourism', 'transport'] + 'neighbourhood': 'Koreatown' } } ] diff --git a/test/unit/sanitiser/reverse.js b/test/unit/sanitiser/reverse.js index 5fb346b7..1465a949 100644 --- a/test/unit/sanitiser/reverse.js +++ b/test/unit/sanitiser/reverse.js @@ -11,13 +11,12 @@ var reverse = require('../../../sanitiser/reverse'), lon: 0, size: 10, private: false, - categories: [], boundary: { } }; // these are the default values you would expect when no input params are specified. // @todo: why is this different from $defaultClean? -var emptyClean = { boundary: {}, categories: [], private: false, size: 10, types: {} }; +var emptyClean = { boundary: {}, private: false, size: 10, types: {} }; module.exports.tests = {}; @@ -36,7 +35,7 @@ module.exports.tests.interface = function(test, common) { module.exports.tests.sanitisers = function(test, common) { test('check sanitiser list', function (t) { - var expected = ['layers', 'sources', 'size', 'private', 'geo_reverse', 'categories', 'boundary_country']; + var expected = ['layers', 'sources', 'size', 'private', 'geo_reverse', 'boundary_country']; t.deepEqual(Object.keys(reverse.sanitiser_list), expected); t.end(); }); @@ -104,7 +103,7 @@ module.exports.tests.sanitize_lon = function(test, common) { var req = { query: { 'point.lat': 0, 'point.lon': lon } }; // @todo: why is lat set? - var expected = { boundary: {}, categories: [], lat: 0, private: false, size: 10, types: {} }; + var expected = { boundary: {}, lat: 0, private: false, size: 10, types: {} }; sanitize(req, function(){ t.equal(req.errors[0], 'missing param \'lon\'', 'longitude is a required field'); t.deepEqual(req.clean, expected, 'clean only has default values set'); @@ -181,45 +180,6 @@ module.exports.tests.sanitize_private = function(test, common) { }); }; -module.exports.tests.sanitize_categories = function(test, common) { - var req = { query: { 'point.lat': 0, 'point.lon': 0 } }; - test('unspecified', function(t) { - req.query.categories = undefined; - sanitize(req, function(){ - t.deepEqual(req.clean.categories, defaultClean.categories, 'default to empty categories array'); - t.end(); - }); - }); - test('single category', function(t) { - req.query.categories = 'food'; - sanitize(req, function(){ - t.deepEqual(req.clean.categories, ['food'], 'category set'); - t.end(); - }); - }); - test('multiple categories', function(t) { - req.query.categories = 'food,education,nightlife'; - sanitize(req, function(){ - t.deepEqual(req.clean.categories, ['food', 'education', 'nightlife'], 'categories set'); - t.end(); - }); - }); - test('whitespace and empty strings', function(t) { - req.query.categories = 'food, , nightlife ,'; - sanitize(req, function(){ - t.deepEqual(req.clean.categories, ['food', 'nightlife'], 'categories set'); - t.end(); - }); - }); - test('all empty strings', function(t) { - req.query.categories = ', , ,'; - sanitize(req, function(){ - t.deepEqual(req.clean.categories, defaultClean.categories, 'empty strings filtered out'); - t.end(); - }); - }); -}; - module.exports.tests.middleware_success = function(test, common) { test('middleware success', function(t) { var req = { query: { 'point.lat': 0, 'point.lon': 0 }}; diff --git a/test/unit/sanitiser/search.js b/test/unit/sanitiser/search.js index 6e234e50..5992f94e 100644 --- a/test/unit/sanitiser/search.js +++ b/test/unit/sanitiser/search.js @@ -15,7 +15,7 @@ var search = require('../../../sanitiser/search'), // these are the default values you would expect when no input params are specified. // @todo: why is this different from $defaultClean? -var emptyClean = { boundary: {}, categories: [], private: false, size: 10, types: {} }; +var emptyClean = { boundary: {}, private: false, size: 10, types: {} }; module.exports.tests = {}; @@ -34,7 +34,7 @@ module.exports.tests.interface = function(test, common) { module.exports.tests.sanitisers = function(test, common) { test('check sanitiser list', function (t) { - var expected = ['text', 'size', 'layers', 'sources', 'private', 'geo_search', 'categories', 'boundary_country' ]; + var expected = ['text', 'size', 'layers', 'sources', 'private', 'geo_search', 'boundary_country' ]; t.deepEqual(Object.keys(search.sanitiser_list), expected); t.end(); });