-
Notifications
You must be signed in to change notification settings - Fork 13
/
fetcher_test_data.go
108 lines (101 loc) · 2.02 KB
/
fetcher_test_data.go
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
package ticker
import "regexp"
const testCMCQueryLimit = 5
var httpMocks = map[string]string{
btcavgFiatEndpoint: `{
"BTCUSD": {"ask": "1","bid": "2","last": "3"},
"NOTABTCRATE": {}
}`,
btcavgCryptoEndpoint: `{
"BCHBTC": {"ask": "0.5","0.5": "0.5","last": "0.5"},
"NOTBTC": {"ask": "121","bid": "122","last": "123"},
"SOILBTC": {"ask": "0.0012345","bid": "0.0012345","last": "0.0012345"},
"IOTABTC": {"ask": "0.00102","bid": "0.00102","last": "0.00102"},
"ACCBTC": {"ask": "0.002225","bid": "0.002225","last": "0.002225"},
"ZEROBTC": {"ask": "0","0": "0","last": "0"},
"NOTANALTCOINRATE": {}
}`,
buildCMCEndpoint("sandbox"): `{
"metadata": {"num_cryptocurrencies": 102},
"data": [
{
"id": 1,
"symbol": "SOIL",
"quote": {"BTC": {"price": 0.0012345}}
},
{
"id": 1831,
"symbol": "BCH",
"quote": {"BTC": {"price": 0.5}}
},
{
"id": 2224,
"symbol": "ACC",
"quote": {"BTC": {"price": 0.002224}}
},
{
"id": 2225,
"symbol": "ACC",
"quote": {"BTC": {"price": 0.002225}}
},
{
"id": 2226,
"symbol": "ACC",
"quote": {"BTC": {"price": 0.002226}}
}
]
}`,
buildCMCEndpoint("sandbox"): `{
"metadata": {"num_cryptocurrencies": 102},
"data": [
{
"id": 101,
"symbol": "$$$",
"quote": {"BTC": {"price": 0.101}}
},
{
"id": 102,
"symbol": "IOTA",
"quote": {"BTC": {"price": 0.00102}}
}
]
}`,
}
var testExpectedFetchData = regexp.MustCompile("\\s").ReplaceAllString(`{
"$$$": {
"ask": 9.9009905,
"bid": 9.9009905,
"last": 9.9009905,
"type": "crypto"
},
"BTC": {
"ask": 1,
"bid": 1,
"last": 1,
"type": "crypto"
},
"MIOTA": {
"ask": 980.39215,
"bid": 980.39215,
"last": 980.39215,
"type": "crypto"
},
"NOT": {
"ask": 0.008264462,
"bid": 0.008196721,
"last": 0.008130081,
"type": "crypto"
},
"SOIL": {
"ask": 810.04456,
"bid": 810.04456,
"last": 810.04456,
"type": "crypto"
},
"USD": {
"ask": 1,
"bid": 2,
"last": 3,
"type": "fiat"
}
}`, "")