Browse Source

added street layer

pull/810/head
Stephen Hess 8 years ago
parent
commit
0d1d67d6a2
  1. 6
      controller/predicates/is_coarse_reverse.js
  2. 4
      test/unit/controller/predicates/is_coarse_reverse.js

6
controller/predicates/is_coarse_reverse.js

@ -1,7 +1,9 @@
const _ = require('lodash');
const non_coarse_layers = ['address', 'street', 'venue'];
module.exports = (req, res) => {
// returns true if layers is undefined, empty, or contains 'address' or 'venue'
// returns true if layers is undefined, empty, or contains 'address', 'street', or 'venue'
return !_.isEmpty(req.clean.layers) &&
_.intersection(req.clean.layers, ['address', 'venue']).length === 0;
_.intersection(req.clean.layers, non_coarse_layers).length === 0;
};

4
test/unit/controller/predicates/is_coarse_reverse.js

@ -53,7 +53,7 @@ module.exports.tests.false_conditions = (test, common) => {
});
test('request with layers just "address" or "venue" return false', (t) => {
['address', 'venue'].forEach((non_coarse_layer) => {
['address', 'street', 'venue'].forEach((non_coarse_layer) => {
const req = {
clean: {
layers: [non_coarse_layer]
@ -69,7 +69,7 @@ module.exports.tests.false_conditions = (test, common) => {
});
test('request with layers containing "address" or "venue" and a coarse layer should return false', (t) => {
['address', 'venue'].forEach((non_coarse_layer) => {
['address', 'street', 'venue'].forEach((non_coarse_layer) => {
const req = {
clean: {
layers: [_.sample(coarse_layers), non_coarse_layer]

Loading…
Cancel
Save