Engine/ExchangeManager: Return error for method GetExchangeByName (#760)

* engine: Add error returns

* engine: after merge fixes

* engine: remove interface

* linter: fix shadow declarations

* engine: fix tests

* niterinos: fixed

* GLORIOUS NITS!
This commit is contained in:
Ryan O'Hara-Reid
2021-08-26 13:09:14 +10:00
committed by GitHub
parent 056a809d93
commit 4851e94eba
18 changed files with 361 additions and 237 deletions

View File

@@ -1,6 +1,7 @@
package engine
import (
"errors"
"fmt"
"strings"
"testing"
@@ -55,8 +56,9 @@ func TestExchangeManagerRemoveExchange(t *testing.T) {
b := new(bitfinex.Bitfinex)
b.SetDefaults()
m.Add(b)
if err := m.RemoveExchange("Bitstamp"); err != ErrExchangeNotFound {
t.Error("Bitstamp exchange should return an error")
err := m.RemoveExchange("Bitstamp")
if !errors.Is(err, ErrExchangeNotFound) {
t.Errorf("received: %v but expected: %v", err, ErrExchangeNotFound)
}
if err := m.RemoveExchange("BiTFiNeX"); err != nil {
t.Error("exchange should have been removed")