@ -25,6 +25,7 @@ const IncomingTransactionsController = proxyquire(
const FAKE _CHAIN _ID = '0x1338'
const FAKE _CHAIN _ID = '0x1338'
const MOCK _SELECTED _ADDRESS = '0x0101'
const MOCK _SELECTED _ADDRESS = '0x0101'
const SET _STATE _TIMEOUT = 10
function getEmptyInitState ( ) {
function getEmptyInitState ( ) {
return {
return {
@ -297,7 +298,14 @@ describe('IncomingTransactionsController', function () {
} ,
} ,
)
)
// reply with a valid request for any supported network, so that this test has every opportunity to fail
// reply with a valid request for any supported network, so that this test has every opportunity to fail
for ( const network of [ GOERLI , KOVAN , MAINNET , RINKEBY , ROPSTEN ] ) {
for ( const network of [
GOERLI ,
KOVAN ,
MAINNET ,
RINKEBY ,
ROPSTEN ,
'undefined' ,
] ) {
nock (
nock (
` https://api ${
` https://api ${
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
@ -336,7 +344,7 @@ describe('IncomingTransactionsController', function () {
updateStateCalled ,
updateStateCalled ,
putStateCalled ,
putStateCalled ,
new Promise ( ( _ , reject ) => {
new Promise ( ( _ , reject ) => {
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , 1000 )
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , SET _STATE _TIMEOUT )
} ) ,
} ) ,
] )
] )
assert . fail ( 'Update state should not have been called' )
assert . fail ( 'Update state should not have been called' )
@ -357,7 +365,14 @@ describe('IncomingTransactionsController', function () {
} ,
} ,
)
)
// reply with a valid request for any supported network, so that this test has every opportunity to fail
// reply with a valid request for any supported network, so that this test has every opportunity to fail
for ( const network of [ GOERLI , KOVAN , MAINNET , RINKEBY , ROPSTEN ] ) {
for ( const network of [
GOERLI ,
KOVAN ,
MAINNET ,
RINKEBY ,
ROPSTEN ,
'undefined' ,
] ) {
nock (
nock (
` https://api ${
` https://api ${
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
@ -396,7 +411,7 @@ describe('IncomingTransactionsController', function () {
updateStateCalled ,
updateStateCalled ,
putStateCalled ,
putStateCalled ,
new Promise ( ( _ , reject ) => {
new Promise ( ( _ , reject ) => {
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , 1000 )
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , SET _STATE _TIMEOUT )
} ) ,
} ) ,
] )
] )
assert . fail ( 'Update state should not have been called' )
assert . fail ( 'Update state should not have been called' )
@ -415,7 +430,14 @@ describe('IncomingTransactionsController', function () {
} ,
} ,
)
)
// reply with a valid request for any supported network, so that this test has every opportunity to fail
// reply with a valid request for any supported network, so that this test has every opportunity to fail
for ( const network of [ GOERLI , KOVAN , MAINNET , RINKEBY , ROPSTEN ] ) {
for ( const network of [
GOERLI ,
KOVAN ,
MAINNET ,
RINKEBY ,
ROPSTEN ,
'undefined' ,
] ) {
nock (
nock (
` https://api ${
` https://api ${
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
@ -452,7 +474,7 @@ describe('IncomingTransactionsController', function () {
updateStateCalled ,
updateStateCalled ,
putStateCalled ,
putStateCalled ,
new Promise ( ( _ , reject ) => {
new Promise ( ( _ , reject ) => {
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , 1000 )
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , SET _STATE _TIMEOUT )
} ) ,
} ) ,
] )
] )
assert . fail ( 'Update state should not have been called' )
assert . fail ( 'Update state should not have been called' )
@ -471,7 +493,14 @@ describe('IncomingTransactionsController', function () {
} ,
} ,
)
)
// reply with a valid request for any supported network, so that this test has every opportunity to fail
// reply with a valid request for any supported network, so that this test has every opportunity to fail
for ( const network of [ GOERLI , KOVAN , MAINNET , RINKEBY , ROPSTEN ] ) {
for ( const network of [
GOERLI ,
KOVAN ,
MAINNET ,
RINKEBY ,
ROPSTEN ,
'undefined' ,
] ) {
nock (
nock (
` https://api ${
` https://api ${
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
@ -510,7 +539,7 @@ describe('IncomingTransactionsController', function () {
updateStateCalled ,
updateStateCalled ,
putStateCalled ,
putStateCalled ,
new Promise ( ( _ , reject ) => {
new Promise ( ( _ , reject ) => {
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , 1000 )
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , SET _STATE _TIMEOUT )
} ) ,
} ) ,
] )
] )
assert . fail ( 'Update state should not have been called' )
assert . fail ( 'Update state should not have been called' )
@ -613,7 +642,14 @@ describe('IncomingTransactionsController', function () {
)
)
const NEW _MOCK _SELECTED _ADDRESS = ` ${ MOCK _SELECTED _ADDRESS } 9 `
const NEW _MOCK _SELECTED _ADDRESS = ` ${ MOCK _SELECTED _ADDRESS } 9 `
// reply with a valid request for any supported network, so that this test has every opportunity to fail
// reply with a valid request for any supported network, so that this test has every opportunity to fail
for ( const network of [ GOERLI , KOVAN , MAINNET , RINKEBY , ROPSTEN ] ) {
for ( const network of [
GOERLI ,
KOVAN ,
MAINNET ,
RINKEBY ,
ROPSTEN ,
'undefined' ,
] ) {
nock (
nock (
` https://api ${
` https://api ${
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
@ -659,7 +695,7 @@ describe('IncomingTransactionsController', function () {
updateStateCalled ,
updateStateCalled ,
putStateCalled ,
putStateCalled ,
new Promise ( ( _ , reject ) => {
new Promise ( ( _ , reject ) => {
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , 1000 )
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , SET _STATE _TIMEOUT )
} ) ,
} ) ,
] )
] )
assert . fail ( 'Update state should not have been called' )
assert . fail ( 'Update state should not have been called' )
@ -760,7 +796,14 @@ describe('IncomingTransactionsController', function () {
} ,
} ,
)
)
// reply with a valid request for any supported network, so that this test has every opportunity to fail
// reply with a valid request for any supported network, so that this test has every opportunity to fail
for ( const network of [ GOERLI , KOVAN , MAINNET , RINKEBY , ROPSTEN ] ) {
for ( const network of [
GOERLI ,
KOVAN ,
MAINNET ,
RINKEBY ,
ROPSTEN ,
'undefined' ,
] ) {
nock (
nock (
` https://api ${
` https://api ${
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
network === MAINNET ? '' : ` - ${ network . toLowerCase ( ) } `
@ -804,7 +847,7 @@ describe('IncomingTransactionsController', function () {
updateStateCalled ,
updateStateCalled ,
putStateCalled ,
putStateCalled ,
new Promise ( ( _ , reject ) => {
new Promise ( ( _ , reject ) => {
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , 1000 )
setTimeout ( ( ) => reject ( new Error ( 'TIMEOUT' ) ) , SET _STATE _TIMEOUT )
} ) ,
} ) ,
] )
] )
assert . fail ( 'Update state should not have been called' )
assert . fail ( 'Update state should not have been called' )