@@ -52,11 +52,11 @@ describe('RESTv2', () => {
5252 } )
5353
5454 describe ( 'listener methods' , ( ) => {
55- const testMethod = ( name , url , isPublicReq , ...params ) => {
55+ const testMethod = ( name , url , method , ...params ) => {
5656 describe ( name , ( ) => {
5757 it ( 'calls correct endpoint' , ( done ) => {
5858 const rest = new RESTv2 ( )
59- rest [ isPublicReq ? '_makePublicRequest' : '_makeAuthRequest' ] = ( reqURL ) => {
59+ rest [ method ] = ( reqURL ) => {
6060 assert . strictEqual ( reqURL , url )
6161 done ( )
6262 }
@@ -66,20 +66,20 @@ describe('RESTv2', () => {
6666 }
6767
6868 // TODO: add rest...
69- testMethod ( 'symbols' , '/conf/pub:list:pair:exchange' , true )
70- testMethod ( 'inactiveSymbols' , '/conf/pub:list:pair:exchange:inactive' , true )
71- testMethod ( 'futures' , '/conf/pub:list:pair:futures' , true )
72- testMethod ( 'ledgers' , '/auth/r/ledgers/hist' , false )
73- testMethod ( 'ledgers' , '/auth/r/ledgers/USD/hist' , false , 'USD' )
74- testMethod ( 'publicPulseProfile' , '/pulse/profile/Bitfinex' , true , 'Bitfinex' )
75- testMethod ( 'addPulse' , '/auth/w/pulse/add' , false )
76- testMethod ( 'deletePulse' , '/auth/w/pulse/del' , false )
77- testMethod ( 'publicPulseHistory' , '/pulse/hist?limit=2&end=1589559090651' , true , 2 , 1589559090651 )
78- testMethod ( 'pulseHistory' , '/auth/r/pulse/hist' , false )
79- testMethod ( 'generateInvoice' , '/auth/w/deposit/invoice' , false )
80- testMethod ( 'marketAveragePrice' , '/calc/trade/avg?symbol=fUSD&amount=100' , true , { symbol : 'fUSD' , amount : 100 } )
81- testMethod ( 'keepFunding' , '/auth/w/funding/keep' , false , { type : 'type' , id : 'id' } )
82- testMethod ( 'cancelOrderMulti' , '/auth/w/order/cancel/multi' , false , { id : [ 123 ] } )
83- testMethod ( 'orderMultiOp' , '/auth/w/order/multi' , false , [ [ 'oc_multi' , { id : [ 1 ] } ] ] )
69+ testMethod ( 'symbols' , '/conf/pub:list:pair:exchange' , '_makePublicRequest' )
70+ testMethod ( 'inactiveSymbols' , '/conf/pub:list:pair:exchange:inactive' , '_makePublicRequest' )
71+ testMethod ( 'futures' , '/conf/pub:list:pair:futures' , '_makePublicRequest' )
72+ testMethod ( 'ledgers' , '/auth/r/ledgers/hist' , '_makeAuthRequest' )
73+ testMethod ( 'ledgers' , '/auth/r/ledgers/USD/hist' , '_makeAuthRequest' , 'USD' )
74+ testMethod ( 'publicPulseProfile' , '/pulse/profile/Bitfinex' , '_makePublicRequest' , 'Bitfinex' )
75+ testMethod ( 'addPulse' , '/auth/w/pulse/add' , '_makeAuthRequest' )
76+ testMethod ( 'deletePulse' , '/auth/w/pulse/del' , '_makeAuthRequest' )
77+ testMethod ( 'publicPulseHistory' , '/pulse/hist?limit=2&end=1589559090651' , '_makePublicRequest' , 2 , 1589559090651 )
78+ testMethod ( 'pulseHistory' , '/auth/r/pulse/hist' , '_makeAuthRequest' )
79+ testMethod ( 'generateInvoice' , '/auth/w/deposit/invoice' , '_makeAuthRequest' )
80+ testMethod ( 'marketAveragePrice' , '/calc/trade/avg?symbol=fUSD&amount=100' , '_makePublicPostRequest' , { symbol : 'fUSD' , amount : 100 } )
81+ testMethod ( 'keepFunding' , '/auth/w/funding/keep' , '_makeAuthRequest' , { type : 'type' , id : 'id' } )
82+ testMethod ( 'cancelOrderMulti' , '/auth/w/order/cancel/multi' , '_makeAuthRequest' , { id : [ 123 ] } )
83+ testMethod ( 'orderMultiOp' , '/auth/w/order/multi' , '_makeAuthRequest' , [ [ 'oc_multi' , { id : [ 1 ] } ] ] )
8484 } )
8585} )
0 commit comments