aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/nameForAccount_test.js
diff options
context:
space:
mode:
authorDan Finlay <somniac@me.com>2016-07-08 06:11:21 +0800
committerGitHub <noreply@github.com>2016-07-08 06:11:21 +0800
commit2bd31c3e5024ca88b18190c145008ba87736f129 (patch)
tree27b3f32b69b302de0ac0750ad5b8a34f5f868da5 /test/unit/nameForAccount_test.js
parent3fb36b2dd388d7344fd7b3b7e32dcbafeabc9b48 (diff)
parentac808e681fe6a8666a4842cf7fde23345f63e96a (diff)
downloadtangerine-wallet-browser-2bd31c3e5024ca88b18190c145008ba87736f129.tar
tangerine-wallet-browser-2bd31c3e5024ca88b18190c145008ba87736f129.tar.gz
tangerine-wallet-browser-2bd31c3e5024ca88b18190c145008ba87736f129.tar.bz2
tangerine-wallet-browser-2bd31c3e5024ca88b18190c145008ba87736f129.tar.lz
tangerine-wallet-browser-2bd31c3e5024ca88b18190c145008ba87736f129.tar.xz
tangerine-wallet-browser-2bd31c3e5024ca88b18190c145008ba87736f129.tar.zst
tangerine-wallet-browser-2bd31c3e5024ca88b18190c145008ba87736f129.zip
Merge pull request #406 from MetaMask/ConfirmationStyle
Update transaction confirmation style
Diffstat (limited to 'test/unit/nameForAccount_test.js')
-rw-r--r--test/unit/nameForAccount_test.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/unit/nameForAccount_test.js b/test/unit/nameForAccount_test.js
new file mode 100644
index 000000000..6839d40f8
--- /dev/null
+++ b/test/unit/nameForAccount_test.js
@@ -0,0 +1,44 @@
+var assert = require('assert')
+var sinon = require('sinon')
+
+var path = require('path')
+var contractNamer = require(path.join(__dirname, '..', '..', 'ui', 'lib', 'contract-namer.js'))
+
+describe('contractNamer', function() {
+
+ beforeEach(function() {
+ this.sinon = sinon.sandbox.create()
+ })
+
+ afterEach(function() {
+ this.sinon.restore()
+ })
+
+ describe('naming a contract', function() {
+
+ it('should return nothing for an unknown random account', function() {
+ const input = '0x2386F26FC10000'
+ const output = contractNamer(input)
+ assert.deepEqual(output, null)
+ })
+
+ it('should accept identities as an optional second parameter', function() {
+ const input = '0x2386F26FC10000'.toLowerCase()
+ const expected = 'bar'
+ const identities = {}
+ identities[input] = { name: expected }
+ const output = contractNamer(input, identities)
+ assert.deepEqual(output, expected)
+ })
+
+ it('should check for identities case insensitively', function() {
+ const input = '0x2386F26FC10000'.toLowerCase()
+ const expected = 'bar'
+ const identities = {}
+ identities[input] = { name: expected }
+ const output = contractNamer(input.toUpperCase(), identities)
+ assert.deepEqual(output, expected)
+ })
+
+ })
+})