@ -86,11 +86,11 @@ describe('Gas Duck', function () {
describe ( 'GasReducer()' , function ( ) {
describe ( 'GasReducer()' , function ( ) {
it ( 'should initialize state' , function ( ) {
it ( 'should initialize state' , function ( ) {
assert . deepEqual ( GasReducer ( undefined , { } ) , initState )
assert . deepStrict Equal ( GasReducer ( undefined , { } ) , initState )
} )
} )
it ( 'should return state unchanged if it does not match a dispatched actions type' , function ( ) {
it ( 'should return state unchanged if it does not match a dispatched actions type' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , {
GasReducer ( mockState , {
type : 'someOtherAction' ,
type : 'someOtherAction' ,
value : 'someValue' ,
value : 'someValue' ,
@ -100,21 +100,21 @@ describe('Gas Duck', function () {
} )
} )
it ( 'should set basicEstimateIsLoading to true when receiving a BASIC_GAS_ESTIMATE_LOADING_STARTED action' , function ( ) {
it ( 'should set basicEstimateIsLoading to true when receiving a BASIC_GAS_ESTIMATE_LOADING_STARTED action' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , { type : BASIC _GAS _ESTIMATE _LOADING _STARTED } ) ,
GasReducer ( mockState , { type : BASIC _GAS _ESTIMATE _LOADING _STARTED } ) ,
{ basicEstimateIsLoading : true , ... mockState } ,
{ basicEstimateIsLoading : true , ... mockState } ,
)
)
} )
} )
it ( 'should set basicEstimateIsLoading to false when receiving a BASIC_GAS_ESTIMATE_LOADING_FINISHED action' , function ( ) {
it ( 'should set basicEstimateIsLoading to false when receiving a BASIC_GAS_ESTIMATE_LOADING_FINISHED action' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , { type : BASIC _GAS _ESTIMATE _LOADING _FINISHED } ) ,
GasReducer ( mockState , { type : BASIC _GAS _ESTIMATE _LOADING _FINISHED } ) ,
{ basicEstimateIsLoading : false , ... mockState } ,
{ basicEstimateIsLoading : false , ... mockState } ,
)
)
} )
} )
it ( 'should set basicEstimates when receiving a SET_BASIC_GAS_ESTIMATE_DATA action' , function ( ) {
it ( 'should set basicEstimates when receiving a SET_BASIC_GAS_ESTIMATE_DATA action' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , {
GasReducer ( mockState , {
type : SET _BASIC _GAS _ESTIMATE _DATA ,
type : SET _BASIC _GAS _ESTIMATE _DATA ,
value : { someProp : 'someData123' } ,
value : { someProp : 'someData123' } ,
@ -124,7 +124,7 @@ describe('Gas Duck', function () {
} )
} )
it ( 'should set customData.price when receiving a SET_CUSTOM_GAS_PRICE action' , function ( ) {
it ( 'should set customData.price when receiving a SET_CUSTOM_GAS_PRICE action' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , {
GasReducer ( mockState , {
type : SET _CUSTOM _GAS _PRICE ,
type : SET _CUSTOM _GAS _PRICE ,
value : 4321 ,
value : 4321 ,
@ -134,7 +134,7 @@ describe('Gas Duck', function () {
} )
} )
it ( 'should set customData.limit when receiving a SET_CUSTOM_GAS_LIMIT action' , function ( ) {
it ( 'should set customData.limit when receiving a SET_CUSTOM_GAS_LIMIT action' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , {
GasReducer ( mockState , {
type : SET _CUSTOM _GAS _LIMIT ,
type : SET _CUSTOM _GAS _LIMIT ,
value : 9876 ,
value : 9876 ,
@ -144,7 +144,7 @@ describe('Gas Duck', function () {
} )
} )
it ( 'should set customData.total when receiving a SET_CUSTOM_GAS_TOTAL action' , function ( ) {
it ( 'should set customData.total when receiving a SET_CUSTOM_GAS_TOTAL action' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , {
GasReducer ( mockState , {
type : SET _CUSTOM _GAS _TOTAL ,
type : SET _CUSTOM _GAS _TOTAL ,
value : 10000 ,
value : 10000 ,
@ -154,7 +154,7 @@ describe('Gas Duck', function () {
} )
} )
it ( 'should set errors when receiving a SET_CUSTOM_GAS_ERRORS action' , function ( ) {
it ( 'should set errors when receiving a SET_CUSTOM_GAS_ERRORS action' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , {
GasReducer ( mockState , {
type : SET _CUSTOM _GAS _ERRORS ,
type : SET _CUSTOM _GAS _ERRORS ,
value : { someError : 'error_error' } ,
value : { someError : 'error_error' } ,
@ -164,7 +164,7 @@ describe('Gas Duck', function () {
} )
} )
it ( 'should return the initial state in response to a RESET_CUSTOM_GAS_STATE action' , function ( ) {
it ( 'should return the initial state in response to a RESET_CUSTOM_GAS_STATE action' , function ( ) {
assert . deepEqual (
assert . deepStrict Equal (
GasReducer ( mockState , { type : RESET _CUSTOM _GAS _STATE } ) ,
GasReducer ( mockState , { type : RESET _CUSTOM _GAS _STATE } ) ,
initState ,
initState ,
)
)
@ -173,7 +173,7 @@ describe('Gas Duck', function () {
describe ( 'basicGasEstimatesLoadingStarted' , function ( ) {
describe ( 'basicGasEstimatesLoadingStarted' , function ( ) {
it ( 'should create the correct action' , function ( ) {
it ( 'should create the correct action' , function ( ) {
assert . deepEqual ( basicGasEstimatesLoadingStarted ( ) , {
assert . deepStrict Equal ( basicGasEstimatesLoadingStarted ( ) , {
type : BASIC _GAS _ESTIMATE _LOADING _STARTED ,
type : BASIC _GAS _ESTIMATE _LOADING _STARTED ,
} )
} )
} )
} )
@ -181,7 +181,7 @@ describe('Gas Duck', function () {
describe ( 'basicGasEstimatesLoadingFinished' , function ( ) {
describe ( 'basicGasEstimatesLoadingFinished' , function ( ) {
it ( 'should create the correct action' , function ( ) {
it ( 'should create the correct action' , function ( ) {
assert . deepEqual ( basicGasEstimatesLoadingFinished ( ) , {
assert . deepStrict Equal ( basicGasEstimatesLoadingFinished ( ) , {
type : BASIC _GAS _ESTIMATE _LOADING _FINISHED ,
type : BASIC _GAS _ESTIMATE _LOADING _FINISHED ,
} )
} )
} )
} )
@ -194,7 +194,7 @@ describe('Gas Duck', function () {
await fetchBasicGasEstimates ( ) ( mockDistpatch , ( ) => ( {
await fetchBasicGasEstimates ( ) ( mockDistpatch , ( ) => ( {
gas : { ... initState , basicPriceAEstimatesLastRetrieved : 1000000 } ,
gas : { ... initState , basicPriceAEstimatesLastRetrieved : 1000000 } ,
} ) )
} ) )
assert . deepEqual ( mockDistpatch . getCall ( 0 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 0 ) . args , [
{ type : BASIC _GAS _ESTIMATE _LOADING _STARTED } ,
{ type : BASIC _GAS _ESTIMATE _LOADING _STARTED } ,
] )
] )
assert . ok (
assert . ok (
@ -203,10 +203,10 @@ describe('Gas Duck', function () {
. args [ 0 ] . startsWith ( 'https://api.metaswap.codefi.network/gasPrices' ) ,
. args [ 0 ] . startsWith ( 'https://api.metaswap.codefi.network/gasPrices' ) ,
'should fetch metaswap /gasPrices' ,
'should fetch metaswap /gasPrices' ,
)
)
assert . deepEqual ( mockDistpatch . getCall ( 1 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 1 ) . args , [
{ type : SET _BASIC _PRICE _ESTIMATES _LAST _RETRIEVED , value : 2000000 } ,
{ type : SET _BASIC _PRICE _ESTIMATES _LAST _RETRIEVED , value : 2000000 } ,
] )
] )
assert . deepEqual ( mockDistpatch . getCall ( 2 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 2 ) . args , [
{
{
type : SET _BASIC _GAS _ESTIMATE _DATA ,
type : SET _BASIC _GAS _ESTIMATE _DATA ,
value : {
value : {
@ -216,7 +216,7 @@ describe('Gas Duck', function () {
} ,
} ,
} ,
} ,
] )
] )
assert . deepEqual ( mockDistpatch . getCall ( 3 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 3 ) . args , [
{ type : BASIC _GAS _ESTIMATE _LOADING _FINISHED } ,
{ type : BASIC _GAS _ESTIMATE _LOADING _FINISHED } ,
] )
] )
} )
} )
@ -235,11 +235,11 @@ describe('Gas Duck', function () {
await fetchBasicGasEstimates ( ) ( mockDistpatch , ( ) => ( {
await fetchBasicGasEstimates ( ) ( mockDistpatch , ( ) => ( {
gas : { ... initState } ,
gas : { ... initState } ,
} ) )
} ) )
assert . deepEqual ( mockDistpatch . getCall ( 0 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 0 ) . args , [
{ type : BASIC _GAS _ESTIMATE _LOADING _STARTED } ,
{ type : BASIC _GAS _ESTIMATE _LOADING _STARTED } ,
] )
] )
assert . ok ( window . fetch . notCalled )
assert . ok ( window . fetch . notCalled )
assert . deepEqual ( mockDistpatch . getCall ( 1 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 1 ) . args , [
{
{
type : SET _BASIC _GAS _ESTIMATE _DATA ,
type : SET _BASIC _GAS _ESTIMATE _DATA ,
value : {
value : {
@ -249,7 +249,7 @@ describe('Gas Duck', function () {
} ,
} ,
} ,
} ,
] )
] )
assert . deepEqual ( mockDistpatch . getCall ( 2 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 2 ) . args , [
{ type : BASIC _GAS _ESTIMATE _LOADING _FINISHED } ,
{ type : BASIC _GAS _ESTIMATE _LOADING _FINISHED } ,
] )
] )
} )
} )
@ -263,7 +263,7 @@ describe('Gas Duck', function () {
await fetchBasicGasEstimates ( ) ( mockDistpatch , ( ) => ( {
await fetchBasicGasEstimates ( ) ( mockDistpatch , ( ) => ( {
gas : { ... initState } ,
gas : { ... initState } ,
} ) )
} ) )
assert . deepEqual ( mockDistpatch . getCall ( 0 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 0 ) . args , [
{ type : BASIC _GAS _ESTIMATE _LOADING _STARTED } ,
{ type : BASIC _GAS _ESTIMATE _LOADING _STARTED } ,
] )
] )
assert . ok (
assert . ok (
@ -272,10 +272,10 @@ describe('Gas Duck', function () {
. args [ 0 ] . startsWith ( 'https://api.metaswap.codefi.network/gasPrices' ) ,
. args [ 0 ] . startsWith ( 'https://api.metaswap.codefi.network/gasPrices' ) ,
'should fetch metaswap /gasPrices' ,
'should fetch metaswap /gasPrices' ,
)
)
assert . deepEqual ( mockDistpatch . getCall ( 1 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 1 ) . args , [
{ type : SET _BASIC _PRICE _ESTIMATES _LAST _RETRIEVED , value : 2000000 } ,
{ type : SET _BASIC _PRICE _ESTIMATES _LAST _RETRIEVED , value : 2000000 } ,
] )
] )
assert . deepEqual ( mockDistpatch . getCall ( 2 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 2 ) . args , [
{
{
type : SET _BASIC _GAS _ESTIMATE _DATA ,
type : SET _BASIC _GAS _ESTIMATE _DATA ,
value : {
value : {
@ -285,7 +285,7 @@ describe('Gas Duck', function () {
} ,
} ,
} ,
} ,
] )
] )
assert . deepEqual ( mockDistpatch . getCall ( 3 ) . args , [
assert . deepStrict Equal ( mockDistpatch . getCall ( 3 ) . args , [
{ type : BASIC _GAS _ESTIMATE _LOADING _FINISHED } ,
{ type : BASIC _GAS _ESTIMATE _LOADING _FINISHED } ,
] )
] )
} )
} )
@ -293,7 +293,7 @@ describe('Gas Duck', function () {
describe ( 'setBasicGasEstimateData' , function ( ) {
describe ( 'setBasicGasEstimateData' , function ( ) {
it ( 'should create the correct action' , function ( ) {
it ( 'should create the correct action' , function ( ) {
assert . deepEqual ( setBasicGasEstimateData ( 'mockBasicEstimatData' ) , {
assert . deepStrict Equal ( setBasicGasEstimateData ( 'mockBasicEstimatData' ) , {
type : SET _BASIC _GAS _ESTIMATE _DATA ,
type : SET _BASIC _GAS _ESTIMATE _DATA ,
value : 'mockBasicEstimatData' ,
value : 'mockBasicEstimatData' ,
} )
} )
@ -302,7 +302,7 @@ describe('Gas Duck', function () {
describe ( 'setCustomGasPrice' , function ( ) {
describe ( 'setCustomGasPrice' , function ( ) {
it ( 'should create the correct action' , function ( ) {
it ( 'should create the correct action' , function ( ) {
assert . deepEqual ( setCustomGasPrice ( 'mockCustomGasPrice' ) , {
assert . deepStrict Equal ( setCustomGasPrice ( 'mockCustomGasPrice' ) , {
type : SET _CUSTOM _GAS _PRICE ,
type : SET _CUSTOM _GAS _PRICE ,
value : 'mockCustomGasPrice' ,
value : 'mockCustomGasPrice' ,
} )
} )
@ -311,7 +311,7 @@ describe('Gas Duck', function () {
describe ( 'setCustomGasLimit' , function ( ) {
describe ( 'setCustomGasLimit' , function ( ) {
it ( 'should create the correct action' , function ( ) {
it ( 'should create the correct action' , function ( ) {
assert . deepEqual ( setCustomGasLimit ( 'mockCustomGasLimit' ) , {
assert . deepStrict Equal ( setCustomGasLimit ( 'mockCustomGasLimit' ) , {
type : SET _CUSTOM _GAS _LIMIT ,
type : SET _CUSTOM _GAS _LIMIT ,
value : 'mockCustomGasLimit' ,
value : 'mockCustomGasLimit' ,
} )
} )
@ -320,7 +320,7 @@ describe('Gas Duck', function () {
describe ( 'setCustomGasTotal' , function ( ) {
describe ( 'setCustomGasTotal' , function ( ) {
it ( 'should create the correct action' , function ( ) {
it ( 'should create the correct action' , function ( ) {
assert . deepEqual ( setCustomGasTotal ( 'mockCustomGasTotal' ) , {
assert . deepStrict Equal ( setCustomGasTotal ( 'mockCustomGasTotal' ) , {
type : SET _CUSTOM _GAS _TOTAL ,
type : SET _CUSTOM _GAS _TOTAL ,
value : 'mockCustomGasTotal' ,
value : 'mockCustomGasTotal' ,
} )
} )
@ -329,7 +329,7 @@ describe('Gas Duck', function () {
describe ( 'setCustomGasErrors' , function ( ) {
describe ( 'setCustomGasErrors' , function ( ) {
it ( 'should create the correct action' , function ( ) {
it ( 'should create the correct action' , function ( ) {
assert . deepEqual ( setCustomGasErrors ( 'mockErrorObject' ) , {
assert . deepStrict Equal ( setCustomGasErrors ( 'mockErrorObject' ) , {
type : SET _CUSTOM _GAS _ERRORS ,
type : SET _CUSTOM _GAS _ERRORS ,
value : 'mockErrorObject' ,
value : 'mockErrorObject' ,
} )
} )
@ -338,7 +338,9 @@ describe('Gas Duck', function () {
describe ( 'resetCustomGasState' , function ( ) {
describe ( 'resetCustomGasState' , function ( ) {
it ( 'should create the correct action' , function ( ) {
it ( 'should create the correct action' , function ( ) {
assert . deepEqual ( resetCustomGasState ( ) , { type : RESET _CUSTOM _GAS _STATE } )
assert . deepStrictEqual ( resetCustomGasState ( ) , {
type : RESET _CUSTOM _GAS _STATE ,
} )
} )
} )
} )
} )
} )
} )