Improvements in config, currency, exchange, pair and helper code

This commit is contained in:
Adrian Gallagher
2018-01-17 13:42:09 +11:00
parent 3e30bb7213
commit 5dc6df72aa
12 changed files with 475 additions and 373 deletions

View File

@@ -320,6 +320,34 @@ func TestGetAvailableCurrencies(t *testing.T) {
}
}
func TestSupportsCurrency(t *testing.T) {
b := Base{
Name: "TESTNAME",
}
b.AvailablePairs = []string{"BTC-USD", "ETH-USD"}
b.EnabledPairs = []string{"BTC-USD"}
format := config.CurrencyPairFormatConfig{
Delimiter: "-",
Index: "",
}
b.RequestCurrencyPairFormat = format
b.ConfigCurrencyPairFormat = format
if !b.SupportsCurrency(pair.NewCurrencyPair("BTC", "USD"), true) {
t.Error("Test Failed - Exchange SupportsCurrency() incorrect value")
}
if !b.SupportsCurrency(pair.NewCurrencyPair("ETH", "USD"), false) {
t.Error("Test Failed - Exchange SupportsCurrency() incorrect value")
}
if b.SupportsCurrency(pair.NewCurrencyPair("ASD", "ASDF"), true) {
t.Error("Test Failed - Exchange SupportsCurrency() incorrect value")
}
}
func TestGetExchangeFormatCurrencySeperator(t *testing.T) {
cfg := config.GetConfig()
err := cfg.LoadConfig(config.ConfigTestFile)