From 4dd6c8168f3dbec5a0e910069a4a29a640e39942 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 1 Oct 2018 20:28:46 -0230 Subject: Add ability to whitelist a blacklisted domain at runtime --- test/unit/app/controllers/blacklist-controller-test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/unit/app/controllers/blacklist-controller-test.js b/test/unit/app/controllers/blacklist-controller-test.js index 085641777..7a14c02cc 100644 --- a/test/unit/app/controllers/blacklist-controller-test.js +++ b/test/unit/app/controllers/blacklist-controller-test.js @@ -8,6 +8,16 @@ describe('blacklist controller', function () { blacklistController = new BlacklistController() }) + describe('whitelistDomain', function () { + it('should add hostname to the runtime whitelist', function () { + blacklistController.whitelistDomain('foo.com') + assert.deepEqual(blacklistController.store.getState().whitelist, ['foo.com']) + + blacklistController.whitelistDomain('bar.com') + assert.deepEqual(blacklistController.store.getState().whitelist, ['bar.com', 'foo.com']) + }) + }) + describe('checkForPhishing', function () { it('should not flag whitelisted values', function () { const result = blacklistController.checkForPhishing('www.metamask.io') @@ -37,5 +47,10 @@ describe('blacklist controller', function () { const result = blacklistController.checkForPhishing('zero-faucet.metamask.io') assert.equal(result, false) }) + it('should not flag whitelisted domain', function () { + blacklistController.whitelistDomain('metamask.com') + const result = blacklistController.checkForPhishing('metamask.com') + assert.equal(result, false) + }) }) }) -- cgit v1.2.3