1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 09:23:21 +01:00

Fix explorer link generation

This commit is contained in:
Dan Finlay 2016-04-27 14:43:09 -07:00
parent 0c293f9df0
commit 39a84c0e47
2 changed files with 15 additions and 1 deletions

View File

@ -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')
})
})

View File

@ -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 = ''
}