File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import test from 'ava'
2+ import nock from 'nock' ;
3+ import Binance , { ErrorCodes } from 'index'
4+
5+ const binance = Binance ( )
6+
7+ let interceptedUrl = null ;
8+ let interceptedBody = null ;
9+
10+ test . beforeEach ( t => {
11+
12+ interceptedUrl = null ;
13+ interceptedBody = null ;
14+ nock ( / .* / )
15+ . get ( / .* / )
16+ . reply ( 200 , function ( uri , requestBody ) {
17+ interceptedUrl = `${ this . req . options . proto } ://${ this . req . options . hostname } ${ uri } ` ;
18+ interceptedBody = requestBody ;
19+ return { success : true } ;
20+ } ) ;
21+ nock ( / .* / )
22+ . post ( / .* / )
23+ . reply ( 200 , function ( uri , requestBody ) {
24+ interceptedUrl = `${ this . req . options . proto } ://${ this . req . options . hostname } ${ uri } ` ;
25+ interceptedBody = requestBody ;
26+ return { success : true } ;
27+ } ) ;
28+ nock ( / .* / )
29+ . delete ( / .* / )
30+ . reply ( 200 , function ( uri , requestBody ) {
31+ interceptedUrl = `${ this . req . options . proto } ://${ this . req . options . hostname } ${ uri } ` ;
32+ interceptedBody = requestBody ;
33+ return { success : true } ;
34+ } ) ;
35+ } ) ;
36+
37+ test ( '[REST] Prices no symbol' , async t => {
38+ await binance . prices ( ) ;
39+ t . is ( interceptedUrl , 'https://api.binance.com/api/v3/ticker/price' )
40+ } )
You can’t perform that action at this time.
0 commit comments