forked from smartcontractkit/external-adapters-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixtures.ts
54 lines (50 loc) · 1.13 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
import nock from 'nock'
export const mockRateResponseSuccess = (): nock.Scope =>
nock('https://api.binance.com', {
encodedQueryParams: true,
})
.get('/api/v3/ticker/price')
.query({ symbol: 'ETHBTC' })
.reply(200, () => ({ symbol: 'ETHBTC', price: '0.07077300' }))
export const mockRateResponseFailure = (): nock.Scope =>
nock('https://api.binance.com', {
encodedQueryParams: true,
})
.get('/api/v3/ticker/price')
.query({ symbol: 'NONEXISTING' })
.reply(400, () => ({ code: -1121, msg: 'Invalid symbol.' }))
export const mockSubscribeResponse = {
request: {
method: 'SUBSCRIBE',
params: ['ethbtc@miniTicker'],
id: 1,
},
response: [
{
result: null,
id: 1,
},
{
e: '24hrMiniTicker',
E: 1644423671193,
s: 'ETHBTC',
c: '0.07077300',
o: '0.07061500',
h: '0.07267800',
l: '0.07032800',
v: '54395.43030000',
q: '3887.57522175',
},
],
}
export const mockUnsubscribeResponse = {
request: {
method: 'UNSUBSCRIBE',
params: ['ethbtc@miniTicker'],
id: 1,
},
response: {
result: null,
id: 1,
},
}