aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/nameForAccount_test.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-07-08 07:33:06 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-07-08 07:33:06 +0800
commit86b7cc6637edefd2f628238a2abff540c82e1a78 (patch)
treea6126d8b83ec7b66cd2a138c670863beedbefba1 /test/unit/nameForAccount_test.js
parent9a9c1f2cd48235be47e65b42c84bd9bf55ecbec4 (diff)
parent44a45f38be5251eacd2c43ebbc55acf34f65084c (diff)
downloadtangerine-wallet-browser-86b7cc6637edefd2f628238a2abff540c82e1a78.tar
tangerine-wallet-browser-86b7cc6637edefd2f628238a2abff540c82e1a78.tar.gz
tangerine-wallet-browser-86b7cc6637edefd2f628238a2abff540c82e1a78.tar.bz2
tangerine-wallet-browser-86b7cc6637edefd2f628238a2abff540c82e1a78.tar.lz
tangerine-wallet-browser-86b7cc6637edefd2f628238a2abff540c82e1a78.tar.xz
tangerine-wallet-browser-86b7cc6637edefd2f628238a2abff540c82e1a78.tar.zst
tangerine-wallet-browser-86b7cc6637edefd2f628238a2abff540c82e1a78.zip
Resolve merge conflict.
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)
+ })
+
+ })
+})