mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 06:07:06 +01:00
daa20b4b63
* Add missing test descriptions * Fix async tests that expect a rejection These tests expected the function under test to return a rejected promise, and had assertions to be run in the `catch` clause. However, the tests would still pass if the function didn't reject, with the assertions never being run. The tests have been updated to fail if the function doesn't throw. * Handle ignored promise rejection In the case where `forceUpdateMetamaskState` rejects, the function `setSeedPhraseBackedUp` would never resolve. It has been updated to pass along the rejection instead. * Return after rejecting promise in action A few actions would continue after encountering an error, resulting in errors being compounded. Instead all actions will now return after encountering an error (which it looks like was the intention in these cases anyway).
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
const assert = require('assert')
|
|
const getBuyEthUrl = require('../../../app/scripts/lib/buy-eth-url')
|
|
|
|
describe('buy-eth-url', function () {
|
|
const mainnet = {
|
|
network: '1',
|
|
amount: 5,
|
|
address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc',
|
|
}
|
|
const ropsten = {
|
|
network: '3',
|
|
}
|
|
const rinkeby = {
|
|
network: '4',
|
|
}
|
|
const kovan = {
|
|
network: '42',
|
|
}
|
|
|
|
it('returns coinbase url with amount and address for network 1', function () {
|
|
const wyreUrl = getBuyEthUrl(mainnet)
|
|
|
|
assert.equal(wyreUrl, 'https://dash.sendwyre.com/sign-up')
|
|
|
|
})
|
|
|
|
it('returns metamask ropsten faucet for network 3', function () {
|
|
const ropstenUrl = getBuyEthUrl(ropsten)
|
|
assert.equal(ropstenUrl, 'https://faucet.metamask.io/')
|
|
})
|
|
|
|
it('returns rinkeby dapp for network 4', function () {
|
|
const rinkebyUrl = getBuyEthUrl(rinkeby)
|
|
assert.equal(rinkebyUrl, 'https://www.rinkeby.io/')
|
|
})
|
|
|
|
it('returns kovan github test faucet for network 42', function () {
|
|
const kovanUrl = getBuyEthUrl(kovan)
|
|
assert.equal(kovanUrl, 'https://github.com/kovan-testnet/faucet')
|
|
})
|
|
|
|
})
|
|
|