|
|
@ -178,12 +178,22 @@ module.exports.tests.search = function(test, common) { |
|
|
|
] |
|
|
|
] |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
test('geojsonify.search()', function(t) { |
|
|
|
var truthy_params = [true, 1, -1, 123, 'abc']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('geojsonify.search(doc, true) with details', function(t) { |
|
|
|
var json = geojsonify.search( input, true ); |
|
|
|
var json = geojsonify.search( input, true ); |
|
|
|
t.deepEqual(json, expected, 'all docs mapped'); |
|
|
|
t.deepEqual(json, expected, 'all docs (with details) mapped'); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
truthy_params.forEach(function(details) { |
|
|
|
|
|
|
|
test('geojsonify.search(doc, '+ details +') with details', function(t) { |
|
|
|
|
|
|
|
var json = geojsonify.search( input, details ); |
|
|
|
|
|
|
|
t.deepEqual(json, expected, 'all docs (with details) mapped'); |
|
|
|
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var no_details_expected = { |
|
|
|
var no_details_expected = { |
|
|
|
'type': 'FeatureCollection', |
|
|
|
'type': 'FeatureCollection', |
|
|
|
'bbox': [ -73.985656, 40.748432, -0.101795, 51.5337144 ], |
|
|
|
'bbox': [ -73.985656, 40.748432, -0.101795, 51.5337144 ], |
|
|
@ -236,11 +246,21 @@ module.exports.tests.search = function(test, common) { |
|
|
|
] |
|
|
|
] |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
test('geojsonify.search() with no details (default)', function(t) { |
|
|
|
test('geojsonify.search(doc) with no details (default)', function(t) { |
|
|
|
var json = geojsonify.search( input ); |
|
|
|
var json = geojsonify.search( input ); |
|
|
|
t.deepEqual(json, no_details_expected, 'all docs (with no details) mapped'); |
|
|
|
t.deepEqual(json, no_details_expected, 'all docs (with no details) mapped'); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var falsy_params = [false, undefined, null, 0 ]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
falsy_params.forEach(function(details) { |
|
|
|
|
|
|
|
test('geojsonify.search(doc, '+ details +') with no details', function(t) { |
|
|
|
|
|
|
|
var json = geojsonify.search( input, details ); |
|
|
|
|
|
|
|
t.deepEqual(json, no_details_expected, 'all docs (with no details) mapped'); |
|
|
|
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
module.exports.all = function (tape, common) { |
|
|
|
module.exports.all = function (tape, common) { |
|
|
|