@@ -3,7 +3,6 @@ package balance
3
3
import (
4
4
"context"
5
5
"fmt"
6
- "math"
7
6
"testing"
8
7
"time"
9
8
@@ -19,7 +18,6 @@ import (
19
18
"github.com/code-payments/code-server/pkg/code/data/deposit"
20
19
"github.com/code-payments/code-server/pkg/code/data/intent"
21
20
"github.com/code-payments/code-server/pkg/code/data/transaction"
22
- "github.com/code-payments/code-server/pkg/pointer"
23
21
timelock_token_v1 "github.com/code-payments/code-server/pkg/solana/timelock/v1"
24
22
"github.com/code-payments/code-server/pkg/testutil"
25
23
)
@@ -347,66 +345,6 @@ func TestDefaultCalculation_ExternalAccount(t *testing.T) {
347
345
// Note: not possible with batch method, since we wouldn't have account records
348
346
}
349
347
350
- func TestGetAggregatedBalances (t * testing.T ) {
351
- env := setupBalanceTestEnv (t )
352
-
353
- vmAccount := testutil .NewRandomAccount (t )
354
- owner := testutil .NewRandomAccount (t )
355
-
356
- _ , err := GetPrivateBalance (env .ctx , env .data , owner )
357
- assert .Equal (t , ErrNotManagedByCode , err )
358
-
359
- var expectedTotalBalance , expectedPrivateBalance uint64
360
- for i , accountType := range account .AllAccountTypes {
361
- if accountType == commonpb .AccountType_REMOTE_SEND_GIFT_CARD || accountType == commonpb .AccountType_SWAP {
362
- continue
363
- }
364
-
365
- authority := testutil .NewRandomAccount (t )
366
- if accountType == commonpb .AccountType_PRIMARY {
367
- authority = owner
368
- }
369
-
370
- balance := uint64 (math .Pow10 (i ))
371
- expectedTotalBalance += balance
372
- if accountType != commonpb .AccountType_PRIMARY && accountType != commonpb .AccountType_RELATIONSHIP {
373
- expectedPrivateBalance += balance
374
- }
375
-
376
- timelockAccounts , err := authority .GetTimelockAccounts (vmAccount , common .CoreMintAccount )
377
- require .NoError (t , err )
378
-
379
- timelockRecord := timelockAccounts .ToDBRecord ()
380
- require .NoError (t , env .data .SaveTimelock (env .ctx , timelockRecord ))
381
-
382
- accountInfoRecord := account.Record {
383
- OwnerAccount : owner .PublicKey ().ToBase58 (),
384
- AuthorityAccount : authority .PublicKey ().ToBase58 (),
385
- TokenAccount : timelockRecord .VaultAddress ,
386
- MintAccount : common .CoreMintAccount .PublicKey ().ToBase58 (),
387
- AccountType : accountType ,
388
- }
389
- if accountType == commonpb .AccountType_RELATIONSHIP {
390
- accountInfoRecord .RelationshipTo = pointer .String ("example.com" )
391
- }
392
- require .NoError (t , env .data .CreateAccountInfo (env .ctx , & accountInfoRecord ))
393
-
394
- actionRecord := action.Record {
395
- Intent : testutil .NewRandomAccount (t ).PublicKey ().ToBase58 (),
396
- IntentType : intent .SendPrivatePayment ,
397
- ActionType : action .PrivateTransfer ,
398
- Source : testutil .NewRandomAccount (t ).PublicKey ().ToBase58 (),
399
- Destination : & accountInfoRecord .TokenAccount ,
400
- Quantity : & balance ,
401
- }
402
- require .NoError (t , env .data .PutAllActions (env .ctx , & actionRecord ))
403
- }
404
-
405
- balance , err := GetPrivateBalance (env .ctx , env .data , owner )
406
- require .NoError (t , err )
407
- assert .EqualValues (t , expectedPrivateBalance , balance )
408
- }
409
-
410
348
type balanceTestEnv struct {
411
349
ctx context.Context
412
350
data code_data.Provider
0 commit comments