forked from smartcontractkit/external-adapters-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfixtures.ts
56 lines (53 loc) · 1.14 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
import nock from 'nock'
const symbols = [
'UNI',
'LINK',
'AAVE',
'GRT',
'MKR',
'COMP',
'SUSHI',
'SNX',
'YFI',
'BAT',
'PERP',
'BNT',
]
export const dataProviderConfig = {
coinmarketcap: {
providerUrlEnvVar: 'COINMARKETCAP_PROVIDER_URL',
providerUrl: 'http://localhost:8082',
},
}
export const mockDataProviderResponses = (): void => {
for (const symbol of symbols) {
nock(dataProviderConfig.coinmarketcap.providerUrl)
.post('/', { id: '1', data: { base: symbol, quote: 'USD', endpoint: 'crypto' } })
.reply(
200,
{
jobRunID: '1',
providerStatusCode: 200,
result: 20.509267101358265,
statusCode: 200,
data: {
result: 20.509267101358265,
},
},
[
'X-Powered-By',
'Express',
'Content-Type',
'application/json; charset=utf-8',
'Content-Length',
'714',
'ETag',
'W/"2ca-B0TkX1zAQfIfnHwQo6e4kGAEMCs"',
'Date',
'Wed, 23 Jun 2021 22:38:43 GMT',
'Connection',
'close',
],
)
}
}