-
Notifications
You must be signed in to change notification settings - Fork 308
/
fixtures.ts
111 lines (107 loc) · 2.45 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import nock from 'nock'
const responseHeaders = [
'Content-Type',
'application/json',
'Connection',
'close',
'Vary',
'Accept-Encoding',
'Vary',
'Origin',
]
export const mockResponseSuccess = (api: string): nock.Scope => {
return nock(api, {
encodedQueryParams: true,
})
.get('/hope-money')
.reply(
200,
{
status: 'success',
data: {
total_value_in_usd: 4336387.72,
btc: [
{
amount: 11.737,
fiat_amount: 344719.8,
address: '15PYHP5ZW29B3o19jFNKz6RyRdHCtzJj5H',
},
{
amount: 78.51359603,
fiat_amount: 2305971.8,
address: '1NeikyPfPeca7eYrjpQaZ85cRx1hx6aonA',
},
],
eth: [
{
amount: 117.37,
fiat_amount: 219223.1,
address: '0xDaC46e85f075512e9b4EF0cab58B6F21434eB253',
},
{
amount: 785.1359603,
fiat_amount: 1466473.02,
address: '0x86Edc8da69261F4d6623B3a2494BA262Dc454B7f',
},
],
timestamp: 1690797903,
},
},
responseHeaders,
)
}
export const mockResponseErrorStatus = (api: string): nock.Scope => {
return nock(api, {
encodedQueryParams: true,
})
.get('/hope-money')
.reply(
200,
{
status: 'error',
data: {},
},
responseHeaders,
)
}
export const mockResponseErrorValue = (api: string): nock.Scope => {
return nock(api, {
encodedQueryParams: true,
})
.get('/hope-money')
.reply(
200,
{
status: 'success',
data: {
total_value_in_usd: 100000,
btc: [
{
amount: 1,
fiat_amount: 1,
address: '15PYHP5ZW29B3o19jFNKz6RyRdHCtzJj5H',
},
{
amount: 2,
fiat_amount: 2,
address: '1NeikyPfPeca7eYrjpQaZ85cRx1hx6aonA',
},
],
eth: [
{
amount: 3,
fiat_amount: 3,
address: '0xDaC46e85f075512e9b4EF0cab58B6F21434eB253',
},
{
amount: 4,
fiat_amount: 4,
address: '0x86Edc8da69261F4d6623B3a2494BA262Dc454B7f',
},
],
timestamp: 1690797903,
},
},
responseHeaders,
)
}