@@ -136,6 +136,8 @@ func TestGetLatestTokenAccountRecordsForOwner(t *testing.T) {
136136 authority3 := newRandomTestAccount (t )
137137 authority4 := newRandomTestAccount (t )
138138 authority5 := newRandomTestAccount (t )
139+ authority6 := newRandomTestAccount (t )
140+ authority7 := newRandomTestAccount (t )
139141
140142 for _ , authorityAndType := range []struct {
141143 account * Account
@@ -195,9 +197,30 @@ func TestGetLatestTokenAccountRecordsForOwner(t *testing.T) {
195197 }
196198 require .NoError (t , data .CreateAccountInfo (ctx , swapAccountInfoRecord ))
197199
200+ for i , authority := range []* Account {
201+ authority6 ,
202+ authority7 ,
203+ } {
204+ timelockAccounts , err := authority .GetTimelockAccounts (vmAccount , coreMintAccount )
205+ require .NoError (t , err )
206+
207+ timelockRecord := timelockAccounts .ToDBRecord ()
208+ require .NoError (t , data .SaveTimelock (ctx , timelockRecord ))
209+
210+ accountInfoRecord := & account.Record {
211+ OwnerAccount : owner .PublicKey ().ToBase58 (),
212+ AuthorityAccount : timelockRecord .VaultOwner ,
213+ TokenAccount : timelockRecord .VaultAddress ,
214+ MintAccount : coreMintAccount .PublicKey ().ToBase58 (),
215+ AccountType : commonpb .AccountType_POOL ,
216+ Index : uint64 (i ),
217+ }
218+ require .NoError (t , data .CreateAccountInfo (ctx , accountInfoRecord ))
219+ }
220+
198221 actual , err = GetLatestTokenAccountRecordsForOwner (ctx , data , owner )
199222 require .NoError (t , err )
200- require .Len (t , actual , 4 )
223+ require .Len (t , actual , 5 )
201224
202225 records , ok := actual [commonpb .AccountType_BUCKET_1_KIN ]
203226 require .True (t , ok )
@@ -238,4 +261,20 @@ func TestGetLatestTokenAccountRecordsForOwner(t *testing.T) {
238261 assert .Equal (t , records [0 ].General .AuthorityAccount , authority5 .PublicKey ().ToBase58 ())
239262 assert .Equal (t , records [0 ].General .TokenAccount , swapAta .PublicKey ().ToBase58 ())
240263 assert .Equal (t , records [0 ].General .AccountType , commonpb .AccountType_SWAP )
264+
265+ records , ok = actual [commonpb .AccountType_POOL ]
266+ require .True (t , ok )
267+ require .Len (t , records , 2 )
268+
269+ assert .Equal (t , records [0 ].General .AuthorityAccount , authority6 .PublicKey ().ToBase58 ())
270+ assert .Equal (t , records [0 ].General .AccountType , commonpb .AccountType_POOL )
271+ assert .Equal (t , records [0 ].Timelock .VaultOwner , authority6 .PublicKey ().ToBase58 ())
272+ assert .Equal (t , records [0 ].General .TokenAccount , records [0 ].Timelock .VaultAddress )
273+ assert .EqualValues (t , records [0 ].General .Index , 0 )
274+
275+ assert .Equal (t , records [1 ].General .AuthorityAccount , authority7 .PublicKey ().ToBase58 ())
276+ assert .Equal (t , records [1 ].General .AccountType , commonpb .AccountType_POOL )
277+ assert .Equal (t , records [1 ].Timelock .VaultOwner , authority7 .PublicKey ().ToBase58 ())
278+ assert .Equal (t , records [1 ].General .TokenAccount , records [1 ].Timelock .VaultAddress )
279+ assert .EqualValues (t , records [1 ].General .Index , 1 )
241280}
0 commit comments