Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokisan committed Oct 31, 2023
1 parent 1d80106 commit 225b8ab
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
11 changes: 9 additions & 2 deletions integrationtest/v5/asset/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ func TestGetWithdrawalRecords(t *testing.T) {

func TestGetCoinInfo(t *testing.T) {
client := bybit.NewTestClient().WithAuthFromEnv()
res, err := client.V5().Asset().GetCoinInfo(bybit.V5GetCoinInfoParam{})
coin := bybit.CoinBTC
res, err := client.V5().Asset().GetCoinInfo(bybit.V5GetCoinInfoParam{
Coin: &coin,
})
require.NoError(t, err)
// Fees may be changed, skipped comparison with golden file
{
goldenFilename := "./testdata/v5-asset-get-coin-info.json"
testhelper.Compare(t, goldenFilename, testhelper.ConvertToJSON(res.Result))
testhelper.UpdateFile(t, goldenFilename, testhelper.ConvertToJSON(res.Result))
}
}
3 changes: 1 addition & 2 deletions v5_asset_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ type V5GetCoinInfoResponse struct {

// V5GetCoinInfoResult :
type V5GetCoinInfoResult struct {
Rows V5GetCoinInfoRows `json:"rows"`
NextPageCursor string `json:"nextPageCursor"`
Rows V5GetCoinInfoRows `json:"rows"`
}

// V5GetCoinInfoRows :
Expand Down
46 changes: 42 additions & 4 deletions v5_asset_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,27 @@ func TestGetCoinInfo(t *testing.T) {
status := http.StatusOK
respBody := map[string]interface{}{
"result": map[string]interface{}{
"rows": []map[string]interface{}{},
"nextPageCursor": "",
"rows": []map[string]interface{}{
{
"name": "BTC",
"coin": "BTC",
"remainAmount": "1500",
"chains": []map[string]interface{}{
{
"chain": "BTC",
"chainType": "BTC",
"confirmation": "1",
"withdrawFee": "0.0005",
"depositMin": "0.0005",
"withdrawMin": "0.001",
"minAccuracy": "8",
"chainDeposit": "1",
"chainWithdraw": "1",
"withdrawPercentageFee": "0",
},
},
},
},
},
}
bytesBody, err := json.Marshal(respBody)
Expand Down Expand Up @@ -394,8 +413,27 @@ func TestGetCoinInfo(t *testing.T) {
status := http.StatusOK
respBody := map[string]interface{}{
"result": map[string]interface{}{
"rows": []map[string]interface{}{},
"nextPageCursor": "",
"rows": []map[string]interface{}{
{
"name": "BTC",
"coin": "BTC",
"remainAmount": "1500",
"chains": []map[string]interface{}{
{
"chain": "BTC",
"chainType": "BTC",
"confirmation": "1",
"withdrawFee": "0.0005",
"depositMin": "0.0005",
"withdrawMin": "0.001",
"minAccuracy": "8",
"chainDeposit": "1",
"chainWithdraw": "1",
"withdrawPercentageFee": "0",
},
},
},
},
},
}
bytesBody, err := json.Marshal(respBody)
Expand Down

0 comments on commit 225b8ab

Please sign in to comment.