mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Fix explorer link generation
This commit is contained in:
parent
0c293f9df0
commit
39a84c0e47
11
test/unit/explorer-link-test.js
Normal file
11
test/unit/explorer-link-test.js
Normal 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')
|
||||
})
|
||||
|
||||
})
|
@ -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 = ''
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user