forked from vulpemventures/banco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrates_test.go
43 lines (34 loc) · 870 Bytes
/
rates_test.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
package main
import (
"testing"
)
type MockRatesClient struct{}
func (mrc *MockRatesClient) MarketPrice(base, quote string) (float64, error) {
return 0.0, nil
}
func (mrc *MockRatesClient) Subscribe() error {
return nil
}
func (mrc *MockRatesClient) FeePercentage(inputTicker, outputTicker string) float64 {
return 0.0
}
func TestRates(t *testing.T) {
mockClient := &MockRatesClient{}
rates := Rates{
Client: mockClient,
}
// Test MarketPriceStream
err := rates.Client.Subscribe()
if err != nil {
t.Errorf("Error calling MarketPriceStream: %s", err.Error())
}
// Test FeePercentage
fee := rates.Client.FeePercentage("L-BTC", "USD")
if fee != 0.0 {
t.Errorf("Expected fee percentage to be 0.0, got %f", fee)
}
_, err = rates.Client.MarketPrice("L-BTC", "USDT")
if err != nil {
t.Errorf("Error calling MarketPrice: %s", err.Error())
}
}