mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +00:00
exchanges: improves GetDefaultConfig method (#1245)
* exchanges: Add function to get standard config * exchanges: add tests (cherry-pick here and above) * after pick stuff * cleanup --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -380,12 +380,38 @@ func TestGetDefaultConfigurations(t *testing.T) {
|
||||
|
||||
defaultCfg, err := exch.GetDefaultConfig(context.Background())
|
||||
if err != nil {
|
||||
// Use Error instead of fatal to allow all issues to arise
|
||||
t.Error(err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if defaultCfg == nil {
|
||||
t.Error("expected config")
|
||||
t.Fatal("expected config")
|
||||
}
|
||||
|
||||
if defaultCfg.Name == "" {
|
||||
t.Error("name unset SetDefaults() not called")
|
||||
}
|
||||
|
||||
if !defaultCfg.Enabled {
|
||||
t.Error("expected enabled", defaultCfg.Name)
|
||||
}
|
||||
|
||||
if exch.SupportsWebsocket() {
|
||||
if defaultCfg.WebsocketResponseCheckTimeout <= 0 {
|
||||
t.Error("expected websocketResponseCheckTimeout to be greater than 0", defaultCfg.Name)
|
||||
}
|
||||
|
||||
if defaultCfg.WebsocketResponseMaxLimit <= 0 {
|
||||
t.Error("expected WebsocketResponseMaxLimit to be greater than 0", defaultCfg.Name)
|
||||
}
|
||||
|
||||
if defaultCfg.WebsocketTrafficTimeout <= 0 {
|
||||
t.Error("expected WebsocketTrafficTimeout to be greater than 0", defaultCfg.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// Makes sure the config is valid and can be used to setup the exchange
|
||||
if err := exch.Setup(defaultCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user