Fix explorer link generation
This commit is contained in:
parent
0c293f9df0
commit
39a84c0e47
|
@ -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')
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
|
@ -1,10 +1,13 @@
|
||||||
module.exports = function(hash, network) {
|
module.exports = function(hash, network) {
|
||||||
|
const net = parseInt(network)
|
||||||
let prefix
|
let prefix
|
||||||
switch (network) {
|
switch (net) {
|
||||||
case 1: // main net
|
case 1: // main net
|
||||||
prefix = ''
|
prefix = ''
|
||||||
|
break
|
||||||
case 2: // morden test net
|
case 2: // morden test net
|
||||||
prefix = 'testnet.'
|
prefix = 'testnet.'
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
prefix = ''
|
prefix = ''
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue