forked from smartcontractkit/external-adapters-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfixtures.ts
42 lines (41 loc) · 1.22 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
import nock from 'nock'
import { getPreviousNonWeekendDay } from '../../src/transport/utils'
export const mockResponseSuccess = (): nock.Scope =>
nock('https://api.superstate.co/v1/funds', {
encodedQueryParams: true,
})
.get('/1/nav-daily')
// Since the date params change daily, it's safe here to return true, instead of mocking the whole DATE object
.query(() => true)
.reply(
200,
() => [
{
fund_id: 1,
net_asset_value_date: getPreviousNonWeekendDay('America/New_York'),
net_asset_value: '10.170643',
assets_under_management: '88412710.730070366913',
outstanding_shares: '8692932.268891000000',
net_income_expenses: '12985.55666',
},
{
fund_id: 1,
net_asset_value_date: '05/03/2024',
net_asset_value: '10.16915',
assets_under_management: '88399732.182192912650',
outstanding_shares: '8692932.268891000000',
net_income_expenses: '38082.331663',
},
],
[
'Content-Type',
'application/json',
'Connection',
'close',
'Vary',
'Accept-Encoding',
'Vary',
'Origin',
],
)
.persist()