Browse Source

flag_bool expects parameter opts.paramName

pull/942/head
Lily He 7 years ago
parent
commit
bf234f5539
  1. 2
      sanitizer/_flag_bool.js
  2. 4
      test/unit/sanitizer/_flag_bool.js

2
sanitizer/_flag_bool.js

@ -41,7 +41,7 @@ function _setup( paramName, defaultValue ) {
}, // end of _sanitize function }, // end of _sanitize function
expected: function _expected(){ expected: function _expected(){
return [{ name: 'private'}]; return [{ name: opts.paramName}];
} // end of _expected function } // end of _expected function
}; // end of return object }; // end of return object
} // end of _setup function } // end of _setup function

4
test/unit/sanitizer/_flag_bool.js

@ -53,8 +53,8 @@ module.exports.tests.validate_default_behavior = function(test, common) {
module.exports.tests.check_valid_parameters = function(test, common) { module.exports.tests.check_valid_parameters = function(test, common) {
test('return an array of expected parameters in object form for validation', (t) => { test('return an array of expected parameters in object form for validation', (t) => {
const expected = [{ name: 'private' }]; const expected = [{ name: 'value' }]; // depends on first argument of sanitizer()
const validParameters = sanitizer('dirty_param', true).expected(); const validParameters = sanitizer('value', true).expected();
t.deepEquals(validParameters, expected); t.deepEquals(validParameters, expected);
t.end(); t.end();
}); });

Loading…
Cancel
Save