aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorFrankie <frankie.pangilinan@consensys.net>2016-06-09 05:12:25 +0800
committerFrankie <frankie.pangilinan@consensys.net>2016-06-09 05:12:25 +0800
commit03e9ff6e42fe230a1f7a0e6185eca57248c7a2ed (patch)
treee47867a4f8a8ad4d6ed3ae200cc08c7f0dc1f88c /test/unit
parente9407777cc6f44a87a4c34e07562f278d66a48c4 (diff)
parent1836b83a530a001b83bffebbcf3483220fa02a21 (diff)
downloadtangerine-wallet-browser-03e9ff6e42fe230a1f7a0e6185eca57248c7a2ed.tar
tangerine-wallet-browser-03e9ff6e42fe230a1f7a0e6185eca57248c7a2ed.tar.gz
tangerine-wallet-browser-03e9ff6e42fe230a1f7a0e6185eca57248c7a2ed.tar.bz2
tangerine-wallet-browser-03e9ff6e42fe230a1f7a0e6185eca57248c7a2ed.tar.lz
tangerine-wallet-browser-03e9ff6e42fe230a1f7a0e6185eca57248c7a2ed.tar.xz
tangerine-wallet-browser-03e9ff6e42fe230a1f7a0e6185eca57248c7a2ed.tar.zst
tangerine-wallet-browser-03e9ff6e42fe230a1f7a0e6185eca57248c7a2ed.zip
Mend CHANGE.log
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/lib/icon-factory-test.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/unit/lib/icon-factory-test.js b/test/unit/lib/icon-factory-test.js
new file mode 100644
index 000000000..2f24d408c
--- /dev/null
+++ b/test/unit/lib/icon-factory-test.js
@@ -0,0 +1,31 @@
+const assert = require('assert')
+const sinon = require('sinon')
+
+const path = require('path')
+const IconFactoryGen = require(path.join(__dirname, '..', '..', '..', 'ui', 'lib', 'icon-factory.js'))
+
+describe('icon-factory', function() {
+ let iconFactory, address, diameter
+
+ beforeEach(function() {
+ iconFactory = IconFactoryGen((d,n) => 'stubicon')
+ address = '0x012345671234567890'
+ diameter = 50
+ })
+
+ it('should return a data-uri string for any address and diameter', function() {
+ const output = iconFactory.iconForAddress(address, diameter)
+ assert.ok(output.indexOf('data:image/svg') === 0)
+ assert.equal(output, iconFactory.cache[address][diameter])
+ })
+
+ it('should default to cache first', function() {
+ const testOutput = 'foo'
+ const mockSizeCache = {}
+ mockSizeCache[diameter] = testOutput
+ iconFactory.cache[address] = mockSizeCache
+
+ const output = iconFactory.iconForAddress(address, diameter)
+ assert.equal(output, testOutput)
+ })
+})