-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathbalance_test.go
36 lines (29 loc) · 1.2 KB
/
balance_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
package deepseek_test
import (
"context"
"testing"
"github.com/cohesion-org/deepseek-go"
"github.com/cohesion-org/deepseek-go/internal/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGetBalance(t *testing.T) {
testutil.SkipIfShort(t)
config := testutil.LoadTestConfig(t)
client := deepseek.NewClient(config.APIKey)
ctx, cancel := context.WithTimeout(context.Background(), config.TestTimeout)
defer cancel()
balance, err := deepseek.GetBalance(client, ctx)
require.NoError(t, err, "should not return error")
require.NotNil(t, balance, "response should not be nil ")
// Verify response structure
assert.True(t, balance.IsAvailable || !balance.IsAvailable, "IsAvailable should be a boolean")
assert.NotEmpty(t, balance.BalanceInfos, "should have balance information")
// Verify balance info details
for _, info := range balance.BalanceInfos {
assert.NotEmpty(t, info.Currency, "currency should not be empty")
assert.NotEmpty(t, info.TotalBalance, "total balance should not be empty")
assert.NotEmpty(t, info.GrantedBalance, "granted balance should not be empty")
assert.NotEmpty(t, info.ToppedUpBalance, "topped up balance should not be empty")
}
}