Files
gocryptotrader/engine/addr_helpers_test.go
Adrian Gallagher 1daaa66830 Engine changes
Add addr helpers (will be split off into own package)
Engine status updates (log and data dir display)
Use GetPairFormat for various exchanges instead of calling the config
QA fixes
Implement GCTRPC exchange deposit address handling
2019-06-24 17:38:11 +10:00

65 lines
1.3 KiB
Go

package engine
import (
"testing"
"github.com/thrasher-/gocryptotrader/currency"
)
const (
testBTCAddress = "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
)
func TestSeed(t *testing.T) {
var d DepositAddressStore
u := map[string]map[string]string{
"BITSTAMP": map[string]string{
"BTC": testBTCAddress,
},
}
d.Seed(u)
r, err := d.GetDepositAddress("BITSTAMP", currency.BTC)
if err != nil {
t.Error("unexpected result")
}
if r != testBTCAddress {
t.Error("unexpected result")
}
}
func TestGetDepositAddress(t *testing.T) {
var d DepositAddressStore
_, err := d.GetDepositAddress("", currency.BTC)
if err != ErrDepositAddressStoreIsNil {
t.Error("non-error on non-existent exchange")
}
d.Store = map[string]map[string]string{
"BITSTAMP": map[string]string{
"BTC": testBTCAddress,
},
}
_, err = d.GetDepositAddress("", currency.BTC)
if err != ErrExchangeNotFound {
t.Error("non-error on non-existent exchange")
}
var r string
r, err = d.GetDepositAddress("BiTStAmP", currency.NewCode("bTC"))
if err != nil {
t.Error("unexpected err: ", err)
}
if r != testBTCAddress {
t.Error("unexpected BTC address: ", r)
}
_, err = d.GetDepositAddress("BiTStAmP", currency.LTC)
if err != ErrDepositAddressNotFound {
t.Error("unexpected err: ", err)
}
}