Skip to content

Commit

Permalink
Merge pull request #3015 from fernandollisboa/fix/domain-default-vali…
Browse files Browse the repository at this point in the history
…dation

fix: domain default tld validation
  • Loading branch information
Marsup authored Jan 29, 2024
2 parents a9c01d1 + 582e812 commit 2712034
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/types/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ module.exports = Any.extend({
internals.addressOptions = function (options) {

if (!options) {
return options;
return internals.tlds || options; // $lab:coverage:ignore$
}

// minDomainSegments
Expand Down
6 changes: 4 additions & 2 deletions test/types/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,8 @@ describe('string', () => {
type: 'string.domain',
context: { value: '"example.com', label: 'value' }
}],
['[email protected]', false, '"value" must contain a valid domain name']
['[email protected]', false, '"value" must contain a valid domain name'],
['joi.dev.whatevertldiwant', false, '"value" must contain a valid domain name']
]);
});

Expand Down Expand Up @@ -1496,7 +1497,8 @@ describe('string', () => {
type: 'string.email',
context: { value: '123456789012345678901234567890123456789012345678901234567890@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345.toolong.com', invalids: ['123456789012345678901234567890123456789012345678901234567890@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345.toolong.com'], label: 'value' }
}],
['foo@bar%2ecom', false, '"value" must be a valid email']
['foo@bar%2ecom', false, '"value" must be a valid email'],
['[email protected]', false, '"value" must be a valid email']
]);
});

Expand Down

0 comments on commit 2712034

Please sign in to comment.