diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-08-03 07:20:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-03 07:20:53 +0800 |
commit | 2c37d438885865fb9b93769a6dee9fb32f8d82aa (patch) | |
tree | 19ed66e8fd54b4324d8e5750de061c6562ace19b /test | |
parent | d15e402ed87bf7533250c49a7972a7b1a12c99c2 (diff) | |
parent | 8c6f01b91094564df59d6d95b6f43b811e711824 (diff) | |
download | tangerine-wallet-browser-2c37d438885865fb9b93769a6dee9fb32f8d82aa.tar tangerine-wallet-browser-2c37d438885865fb9b93769a6dee9fb32f8d82aa.tar.gz tangerine-wallet-browser-2c37d438885865fb9b93769a6dee9fb32f8d82aa.tar.bz2 tangerine-wallet-browser-2c37d438885865fb9b93769a6dee9fb32f8d82aa.tar.lz tangerine-wallet-browser-2c37d438885865fb9b93769a6dee9fb32f8d82aa.tar.xz tangerine-wallet-browser-2c37d438885865fb9b93769a6dee9fb32f8d82aa.tar.zst tangerine-wallet-browser-2c37d438885865fb9b93769a6dee9fb32f8d82aa.zip |
Merge pull request #1849 from MetaMask/blacklist-refactor
Blacklist refactor
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/blacklist-controller-test.js | 41 | ||||
-rw-r--r-- | test/unit/blacklister-test.js | 24 |
2 files changed, 41 insertions, 24 deletions
diff --git a/test/unit/blacklist-controller-test.js b/test/unit/blacklist-controller-test.js new file mode 100644 index 000000000..a9260466f --- /dev/null +++ b/test/unit/blacklist-controller-test.js @@ -0,0 +1,41 @@ +const assert = require('assert') +const BlacklistController = require('../../app/scripts/controllers/blacklist') + +describe('blacklist controller', function () { + let blacklistController + + before(() => { + blacklistController = new BlacklistController() + }) + + describe('checkForPhishing', function () { + it('should not flag whitelisted values', function () { + const result = blacklistController.checkForPhishing('www.metamask.io') + assert.equal(result, false) + }) + it('should flag explicit values', function () { + const result = blacklistController.checkForPhishing('metamask.com') + assert.equal(result, true) + }) + it('should flag levenshtein values', function () { + const result = blacklistController.checkForPhishing('metmask.io') + assert.equal(result, true) + }) + it('should not flag not-even-close values', function () { + const result = blacklistController.checkForPhishing('example.com') + assert.equal(result, false) + }) + it('should not flag the ropsten faucet domains', function () { + const result = blacklistController.checkForPhishing('faucet.metamask.io') + assert.equal(result, false) + }) + it('should not flag the mascara domain', function () { + const result = blacklistController.checkForPhishing('zero.metamask.io') + assert.equal(result, false) + }) + it('should not flag the mascara-faucet domain', function () { + const result = blacklistController.checkForPhishing('zero-faucet.metamask.io') + assert.equal(result, false) + }) + }) +})
\ No newline at end of file diff --git a/test/unit/blacklister-test.js b/test/unit/blacklister-test.js deleted file mode 100644 index 1badc2c8f..000000000 --- a/test/unit/blacklister-test.js +++ /dev/null @@ -1,24 +0,0 @@ -const assert = require('assert') -const isPhish = require('../../app/scripts/lib/is-phish') - -describe('blacklister', function () { - describe('#isPhish', function () { - it('should not flag whitelisted values', function () { - var result = isPhish({ hostname: 'www.metamask.io' }) - assert(!result) - }) - it('should flag explicit values', function () { - var result = isPhish({ hostname: 'metamask.com' }) - assert(result) - }) - it('should flag levenshtein values', function () { - var result = isPhish({ hostname: 'metmask.com' }) - assert(result) - }) - it('should not flag not-even-close values', function () { - var result = isPhish({ hostname: 'example.com' }) - assert(!result) - }) - }) -}) - |