Skip to content

Commit

Permalink
feat(node): add addCustomDomains
Browse files Browse the repository at this point in the history
  • Loading branch information
choznerol committed Nov 9, 2021
1 parent 167cad2 commit c3245c5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions platform/javascript/MailChecker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions platform/javascript/MailChecker.tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
},
blacklist: function () {
return blacklist;
},
addCustomDomains: function (domains = []) {
blacklist.push(...domains)
}
};
})(window);
Expand Down
3 changes: 3 additions & 0 deletions platform/node/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions platform/node/index.tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ module.exports = {
},
blacklist: function () {
return blacklist;
},
addCustomDomains: function (domains = []) {
blacklist.push(...domains)
}
};
12 changes: 12 additions & 0 deletions test/platform.node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ suite('Node', function () {
});
});

test("should return false if the domaims is added later", function () {
isValid('foo@youtube.com')
isValid('foo@google.com')
isValid('ok@gmail.com')

MailChecker.addCustomDomains(['youtube.com', 'google.com'])

isInvalid('foo@youtube.com')
isInvalid('foo@google.com')
isValid('ok@gmail.com')
})

});

});

0 comments on commit c3245c5

Please sign in to comment.