bbgo_origin/pkg/exchange/max/maxapi/reward_test.go

44 lines
945 B
Go
Raw Permalink Normal View History

2022-04-20 08:58:42 +00:00
package max
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestRewardService_GetRewardsRequest(t *testing.T) {
key, secret, ok := integrationTestConfigured(t, "MAX")
if !ok {
t.SkipNow()
}
ctx := context.Background()
client := NewRestClient(ProductionAPIURL)
client.Auth(key, secret)
2023-04-12 08:32:56 +00:00
t.Run("v2/rewards", func(t *testing.T) {
req := client.RewardService.NewGetRewardsRequest()
rewards, err := req.Do(ctx)
assert.NoError(t, err)
assert.NotNil(t, rewards)
assert.NotEmpty(t, rewards)
t.Logf("rewards: %+v", rewards)
})
t.Run("v2/rewards with type", func(t *testing.T) {
req := client.RewardService.NewGetRewardsOfTypeRequest(RewardCommission)
rewards, err := req.Do(ctx)
assert.NoError(t, err)
assert.NotNil(t, rewards)
assert.NotEmpty(t, rewards)
t.Logf("rewards: %+v", rewards)
for _, reward := range rewards {
assert.Equal(t, RewardCommission, reward.Type)
}
})
2022-04-20 08:58:42 +00:00
}