diff --git a/src/initializers/joi.ts b/src/initializers/joi.ts index 70f1b63e..a965646d 100644 --- a/src/initializers/joi.ts +++ b/src/initializers/joi.ts @@ -260,7 +260,6 @@ const Joi: JoiWithExtensions = _Joi.extend( args: [ { name: 'allowedTags', - assert: value => Array.isArray(value) && value.length > 0, message: 'must be a non empty array' } ], @@ -275,7 +274,6 @@ const Joi: JoiWithExtensions = _Joi.extend( args: [ { name: 'allowedAttributes', - assert: value => typeof value === 'object' && Object.keys(value).length > 0, message: 'must be a non empty object' } ], diff --git a/test/initializers/joi.test.ts b/test/initializers/joi.test.ts index a78cf5ec..29f4169c 100644 --- a/test/initializers/joi.test.ts +++ b/test/initializers/joi.test.ts @@ -222,6 +222,10 @@ describe('joi extensions', function () { .should .equal('foo'); }); + it('no html at all', function () { + Joi.safeHtml().allowedAttributes({}).allowedTags([]) + .validate('
banana
').value.should.equal('banana'); + }); }); describe('objectid', function () {