1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 21:57:06 +01:00
metamask-extension/test/unit/lib/account-link.test.js
Erik Marks 76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00

45 lines
1.3 KiB
JavaScript

import assert from 'assert';
import getAccountLink from '../../../ui/lib/account-link';
describe('Account link', function () {
describe('getAccountLink', function () {
it('should return the correct block explorer url for an account', function () {
const tests = [
{
expected: 'https://etherscan.io/address/0xabcd',
network: 1,
address: '0xabcd',
},
{
expected: 'https://ropsten.etherscan.io/address/0xdef0',
network: 3,
address: '0xdef0',
rpcPrefs: {},
},
{
// test handling of `blockExplorerUrl` for a custom RPC
expected: 'https://block.explorer/address/0xabcd',
network: 31,
address: '0xabcd',
rpcPrefs: {
blockExplorerUrl: 'https://block.explorer',
},
},
{
// test handling of trailing `/` in `blockExplorerUrl` for a custom RPC
expected: 'https://another.block.explorer/address/0xdef0',
network: 33,
address: '0xdef0',
rpcPrefs: {
blockExplorerUrl: 'https://another.block.explorer/',
},
},
];
tests.forEach(({ expected, address, network, rpcPrefs }) => {
assert.equal(getAccountLink(address, network, rpcPrefs), expected);
});
});
});
});