|
|
@ -7,7 +7,7 @@ var doc = require('../../../sanitiser/doc'), |
|
|
|
defaultLengthError = function(input) { return 'invalid param \''+ input + '\': text length, must be >0'; }, |
|
|
|
defaultLengthError = function(input) { return 'invalid param \''+ input + '\': text length, must be >0'; }, |
|
|
|
defaultFormatError = 'invalid: must be of the format type:id for ex: \'geoname:4163334\'', |
|
|
|
defaultFormatError = 'invalid: must be of the format type:id for ex: \'geoname:4163334\'', |
|
|
|
defaultError = 'invalid param \'id\': text length, must be >0', |
|
|
|
defaultError = 'invalid param \'id\': text length, must be >0', |
|
|
|
defaultMissingTypeError = function(input) {
|
|
|
|
defaultMissingTypeError = function(input) { |
|
|
|
var type = input.split(delimiter)[0]; |
|
|
|
var type = input.split(delimiter)[0]; |
|
|
|
return type + ' is invalid. It must be one of these values - [' + indeces.join(', ') + ']'; }, |
|
|
|
return type + ' is invalid. It must be one of these values - [' + indeces.join(', ') + ']'; }, |
|
|
|
defaultClean = { ids: [ { id: '123', type: 'geoname' } ], details: true }, |
|
|
|
defaultClean = { ids: [ { id: '123', type: 'geoname' } ], details: true }, |
|
|
@ -111,7 +111,7 @@ module.exports.tests.sanitize_details = function(test, common) { |
|
|
|
t.equal(clean.details, false, 'default details set (to false)'); |
|
|
|
t.equal(clean.details, false, 'default details set (to false)'); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
});
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var valid_values = ['true', true, 1]; |
|
|
|
var valid_values = ['true', true, 1]; |
|
|
@ -121,7 +121,7 @@ module.exports.tests.sanitize_details = function(test, common) { |
|
|
|
t.equal(clean.details, true, 'details set to true'); |
|
|
|
t.equal(clean.details, true, 'details set to true'); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
});
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var valid_false_values = ['false', false, 0]; |
|
|
|
var valid_false_values = ['false', false, 0]; |
|
|
@ -131,7 +131,7 @@ module.exports.tests.sanitize_details = function(test, common) { |
|
|
|
t.equal(clean.details, false, 'details set to false'); |
|
|
|
t.equal(clean.details, false, 'details set to false'); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
});
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('test default behavior', function(t) { |
|
|
|
test('test default behavior', function(t) { |
|
|
@ -196,4 +196,4 @@ module.exports.all = function (tape, common) { |
|
|
|
for( var testCase in module.exports.tests ){ |
|
|
|
for( var testCase in module.exports.tests ){ |
|
|
|
module.exports.tests[testCase](test, common); |
|
|
|
module.exports.tests[testCase](test, common); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|