Browse Source

more tests: testing falsy and truthy params

pull/103/head
Harish Krishna 10 years ago
parent
commit
ea78b8268a
  1. 26
      test/unit/helper/geojsonify.js

26
test/unit/helper/geojsonify.js

@ -178,11 +178,21 @@ 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 );
t.deepEqual(json, expected, 'all docs mapped');
t.deepEqual(json, expected, 'all docs (with details) mapped');
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 = {
'type': 'FeatureCollection',
@ -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 );
t.deepEqual(json, no_details_expected, 'all docs (with no details) mapped');
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) {

Loading…
Cancel
Save