Skip to content

Commit ff0afa0

Browse files
committed
init static tests
1 parent 120db27 commit ff0afa0

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

test/static-tests.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
})

0 commit comments

Comments
 (0)