aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/phishing-detection-test.js
blob: affcb16c2ab125ba25cff290fa9a63189c59399b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const assert = require('assert')
const isPhish = require('../../app/scripts/lib/is-phish')

describe('phishing detection test', function () {
  describe('#isPhish', function () {
    it('should not flag whitelisted values', function () {
      var result = isPhish({ hostname: 'www.metamask.io' })
      assert.equal(result, false)
    })
    it('should flag explicit values', function () {
      var result = isPhish({ hostname: 'metamask.com' })
      assert.equal(result, true)
    })
    it('should flag levenshtein values', function () {
      var result = isPhish({ hostname: 'metmask.io' })
      assert.equal(result, true)
    })
    it('should not flag not-even-close values', function () {
      var result = isPhish({ hostname: 'example.com' })
      assert.equal(result, false)
    })
    it('should not flag the ropsten faucet domains', function () {
      var result = isPhish({ hostname: 'faucet.metamask.io' })
      assert.equal(result, false)
    })
    it('should not flag the mascara domain', function () {
      var result = isPhish({ hostname: 'zero.metamask.io' })
      assert.equal(result, false)
    })
    it('should not flag the mascara-faucet domain', function () {
      var result = isPhish({ hostname: 'zero-faucet.metamask.io' })
      assert.equal(result, false)
    })
  })
})