-
Notifications
You must be signed in to change notification settings - Fork 1
/
crypto_test.go
54 lines (43 loc) · 1.19 KB
/
crypto_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
44
45
46
47
48
49
50
51
52
53
54
package valr_test
import (
"context"
"testing"
"github.com/nickcorin/valr"
"github.com/nickcorin/valr/mock"
"github.com/stretchr/testify/suite"
)
type cryptoTestSuite struct {
suite.Suite
client valr.Client
server *mock.Server
}
func TestCryptoTestSuite(t *testing.T) {
suite.Run(t, new(cryptoTestSuite))
}
func (suite *cryptoTestSuite) SetupSuite() {
suite.server = mock.NewServer()
suite.client = valr.NewClientForTesting(suite.T(), suite.server.URL)
}
func (suite *cryptoTestSuite) TestDepositAddress() {
addr, err := suite.client.DepositAddress(context.TODO(), "ETH")
suite.Require().NoError(err)
suite.Require().NotNil(addr)
eth := valr.DepositAddress{
Address: "0xA7Fae2Fd50886b962d46FF4280f595A3982aeAa5",
Currency: "ETH",
}
suite.Require().EqualValues(ð, addr)
}
func (suite *cryptoTestSuite) TestWithdrawalInfo() {
info, err := suite.client.WithdrawalInfo(context.TODO(), "BTC")
suite.Require().NoError(err)
suite.Require().NotNil(info)
btc := valr.WithdrawalInfo{
Currency: "BTC",
IsActive: true,
MinWithdrawalAmount: "0.0002",
SupportsPaymentRef: false,
WithdrawalCost: "0.0004",
}
suite.Require().EqualValues(&btc, info)
}