aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-08-05 02:45:22 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-08-05 02:45:22 +0800
commit89a4fef1e4043323c89bf8aea8600a16353c4d1b (patch)
tree2305525899aa31dd80c3d6bfcfadb6de4cfda783 /test
parentfa3df576bcf879904b303c4ed1015d27db64642d (diff)
parentc4cb371ce8ddad10d575b4ddb6cb85fe4689ca59 (diff)
downloadtangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.gz
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.bz2
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.lz
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.xz
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.zst
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.zip
Merge branch 'master' into transactionControllerRefractor
Diffstat (limited to 'test')
-rw-r--r--test/unit/actions/tx_test.js10
-rw-r--r--test/unit/blacklist-controller-test.js41
-rw-r--r--test/unit/blacklister-test.js24
-rw-r--r--test/unit/nodeify-test.js11
4 files changed, 58 insertions, 28 deletions
diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js
index 0ea1bfdc7..67c72e9a5 100644
--- a/test/unit/actions/tx_test.js
+++ b/test/unit/actions/tx_test.js
@@ -45,13 +45,15 @@ describe('tx confirmation screen', function () {
before(function (done) {
actions._setBackgroundConnection({
approveTransaction (txId, cb) { cb('An error!') },
- cancelTransaction (txId) { /* noop */ },
+ cancelTransaction (txId, cb) { cb() },
clearSeedWordCache (cb) { cb() },
})
- const action = actions.cancelTx({value: firstTxId})
- result = reducers(initialState, action)
- done()
+ actions.cancelTx({value: firstTxId})((action) => {
+ result = reducers(initialState, action)
+ done()
+ })
+
})
it('should transition to the account detail view', function () {
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)
- })
- })
-})
-
diff --git a/test/unit/nodeify-test.js b/test/unit/nodeify-test.js
index 06241334d..537dae605 100644
--- a/test/unit/nodeify-test.js
+++ b/test/unit/nodeify-test.js
@@ -17,4 +17,15 @@ describe('nodeify', function () {
done()
})
})
+
+ it('should throw if the last argument is not a function', function (done) {
+ const nodified = nodeify(obj.promiseFunc, obj)
+ try {
+ nodified('baz')
+ done(new Error('should have thrown if the last argument is not a function'))
+ } catch (err) {
+ assert.equal(err.message, 'callback is not a function')
+ done()
+ }
+ })
})