-
Notifications
You must be signed in to change notification settings - Fork 316
/
Copy pathfixtures.ts
65 lines (63 loc) · 1.76 KB
/
fixtures.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import nock from 'nock'
export const mockRateResponseSuccess = (): nock.Scope =>
nock('https://dex-asiapacific.binance.org', {
encodedQueryParams: true,
})
.get('/api/v1/ticker/24hr')
.query({ symbol: 'BUSD-BD1_USDT-6D8' })
.reply(
200,
() => [
{
symbol: 'BUSD-BD1_USDT-6D8',
baseAssetName: 'BUSD-BD1',
quoteAssetName: 'USDT-6D8',
priceChange: '0.00050000',
priceChangePercent: '0.0500',
prevClosePrice: '0.99900000',
lastPrice: '1.00000000',
lastQuantity: '22.00000000',
openPrice: '0.99950000',
highPrice: '1.00980000',
lowPrice: '0.99700000',
openTime: 1636993579000,
closeTime: 163707997900000000000000000000000000,
firstId: '202650439-0',
lastId: '202857405-0',
bidPrice: '0.99900000',
bidQuantity: '6766.00000000',
askPrice: '1.00000000',
askQuantity: '1515.00000000',
weightedAvgPrice: '1.00001116',
volume: '253006.00000000',
quoteVolume: '253008.82463200',
count: 337,
},
],
[
'Content-Type',
'application/json',
'Connection',
'close',
'Vary',
'Accept-Encoding',
'Vary',
'Origin',
],
)
export const mockRateResponseFailure = (): nock.Scope =>
nock('https://dex-asiapacific.binance.org', {
encodedQueryParams: true,
})
.get('/api/v1/ticker/24hr')
.query({ symbol: 'NON_EXISTING' })
.reply(400, () => ({ code: 400, message: 'Symbol is not valid' }), [
'Content-Type',
'application/json',
'Connection',
'close',
'Vary',
'Accept-Encoding',
'Vary',
'Origin',
])