@@ -3,7 +3,6 @@ package balance
33import (
44 "context"
55 "fmt"
6- "math"
76 "testing"
87 "time"
98
@@ -19,7 +18,6 @@ import (
1918 "github.com/code-payments/code-server/pkg/code/data/deposit"
2019 "github.com/code-payments/code-server/pkg/code/data/intent"
2120 "github.com/code-payments/code-server/pkg/code/data/transaction"
22- "github.com/code-payments/code-server/pkg/pointer"
2321 timelock_token_v1 "github.com/code-payments/code-server/pkg/solana/timelock/v1"
2422 "github.com/code-payments/code-server/pkg/testutil"
2523)
@@ -347,66 +345,6 @@ func TestDefaultCalculation_ExternalAccount(t *testing.T) {
347345 // Note: not possible with batch method, since we wouldn't have account records
348346}
349347
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-
410348type balanceTestEnv struct {
411349 ctx context.Context
412350 data code_data.Provider
0 commit comments