diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-04-28 05:43:09 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-04-28 05:43:09 +0800 |
commit | 39a84c0e47f35bc0e7c2a632683dc9ae802900b3 (patch) | |
tree | 850b9983cf1be8820a4aab9c59a3d6f40d23ee5e | |
parent | 0c293f9df0e6b8284f88f2362aa1099486254dab (diff) | |
download | tangerine-wallet-browser-39a84c0e47f35bc0e7c2a632683dc9ae802900b3.tar tangerine-wallet-browser-39a84c0e47f35bc0e7c2a632683dc9ae802900b3.tar.gz tangerine-wallet-browser-39a84c0e47f35bc0e7c2a632683dc9ae802900b3.tar.bz2 tangerine-wallet-browser-39a84c0e47f35bc0e7c2a632683dc9ae802900b3.tar.lz tangerine-wallet-browser-39a84c0e47f35bc0e7c2a632683dc9ae802900b3.tar.xz tangerine-wallet-browser-39a84c0e47f35bc0e7c2a632683dc9ae802900b3.tar.zst tangerine-wallet-browser-39a84c0e47f35bc0e7c2a632683dc9ae802900b3.zip |
Fix explorer link generation
-rw-r--r-- | test/unit/explorer-link-test.js | 11 | ||||
-rw-r--r-- | ui/lib/explorer-link.js | 5 |
2 files changed, 15 insertions, 1 deletions
diff --git a/test/unit/explorer-link-test.js b/test/unit/explorer-link-test.js new file mode 100644 index 000000000..961b400fd --- /dev/null +++ b/test/unit/explorer-link-test.js @@ -0,0 +1,11 @@ +var assert = require('assert') +var linkGen = require('../../ui/lib/explorer-link') + +describe('explorer-link', function() { + + it('adds testnet prefix to morden test network', function() { + var result = linkGen('hash', '2') + assert.notEqual(result.indexOf('testnet'), -1, 'testnet injected') + }) + +}) diff --git a/ui/lib/explorer-link.js b/ui/lib/explorer-link.js index a2e7872f9..92b3376fa 100644 --- a/ui/lib/explorer-link.js +++ b/ui/lib/explorer-link.js @@ -1,10 +1,13 @@ module.exports = function(hash, network) { + const net = parseInt(network) let prefix - switch (network) { + switch (net) { case 1: // main net prefix = '' + break case 2: // morden test net prefix = 'testnet.' + break default: prefix = '' } |