Skip to content

Commit 0c2960d

Browse files
committed
add more static prices
1 parent 4d77186 commit 0c2960d

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

test/static-tests.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import test from 'ava'
22
import nock from 'nock';
33
import Binance, { ErrorCodes } from 'index'
44

5+
// Warning: For now these tests can't run in parallel due to nock interceptors
56
const binance = Binance()
67

78
let interceptedUrl = null;
89
let interceptedBody = null;
910

10-
test.beforeEach(t => {
11-
11+
test.serial.beforeEach(t => {
1212
interceptedUrl = null;
1313
interceptedBody = null;
1414
nock(/.*/)
@@ -34,7 +34,31 @@ test.beforeEach(t => {
3434
});
3535
});
3636

37-
test('[REST] Prices no symbol', async t => {
37+
test.serial('[REST] Prices no symbol', async t => {
3838
await binance.prices();
3939
t.is(interceptedUrl, 'https://api.binance.com/api/v3/ticker/price')
40+
})
41+
42+
test.serial('[REST] Futures Prices no symbol', async t => {
43+
await binance.futuresPrices();
44+
t.is(interceptedUrl, 'https://fapi.binance.com/fapi/v1/ticker/price')
45+
})
46+
47+
48+
test.serial('[REST] Orderbook', async t => {
49+
try {
50+
await binance.book({ symbol: 'BTCUSDT' });
51+
} catch (e) {
52+
// it can throw an error because of the mocked response
53+
}
54+
t.is(interceptedUrl, 'https://api.binance.com/api/v3/depth?symbol=BTCUSDT')
55+
})
56+
57+
test.serial('[REST] Futures Orderbook', async t => {
58+
try {
59+
await binance.futuresBook({ symbol: 'BTCUSDT' });
60+
} catch (e) {
61+
// it can throw an error because of the mocked response
62+
}
63+
t.is(interceptedUrl, 'https://fapi.binance.com/fapi/v1/depth?symbol=BTCUSDT')
4064
})

0 commit comments

Comments
 (0)