Skip to content

Commit

Permalink
uncomment tests related to balance pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Torres-ssf committed Jan 20, 2025
1 parent 34ae0cb commit 6428260
Showing 1 changed file with 51 additions and 47 deletions.
98 changes: 51 additions & 47 deletions packages/account/src/providers/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2187,48 +2187,52 @@ describe('Provider', () => {
expect(pageInfo.endCursor).toBeDefined();
});

// it('can get balances', async () => {
// using launched = await setupTestProviderAndWallets({
// walletsConfig: {
// assets: 110,
// },
// });
// const {
// provider,
// wallets: [wallet],
// } = launched;

// let { balances, pageInfo } = await provider.getBalances(wallet.address, { first: 10 });

// expect(balances.length).toBe(10);
// expect(pageInfo.hasNextPage).toBeTruthy();
// expect(pageInfo.hasPreviousPage).toBeFalsy();
// expect(pageInfo.startCursor).toBeDefined();
// expect(pageInfo.endCursor).toBeDefined();

// ({ balances, pageInfo } = await provider.getBalances(wallet.address, {
// after: pageInfo.endCursor,
// }));

// expect(balances.length).toBe(100);
// expect(pageInfo.hasNextPage).toBeFalsy();
// expect(pageInfo.hasPreviousPage).toBeTruthy();
// expect(pageInfo.startCursor).toBeDefined();
// expect(pageInfo.endCursor).toBeDefined();

// ({ balances, pageInfo } = await provider.getBalances(wallet.address, {
// before: pageInfo.startCursor,
// last: 10,
// }));

// expect(balances.length).toBe(10);
// expect(pageInfo.hasNextPage).toBeFalsy();
// expect(pageInfo.hasPreviousPage).toBeTruthy();
// expect(pageInfo.startCursor).toBeDefined();
// expect(pageInfo.endCursor).toBeDefined();
// });

it.todo('can get balances amount greater than u64', () => {});
it('can get balances', async () => {
using launched = await setupTestProviderAndWallets({
walletsConfig: {
assets: 110,
},
});
const {
provider,
wallets: [wallet],
} = launched;

let { balances, pageInfo } = await provider.getBalances(wallet.address, { first: 10 });

pageInfo = pageInfo as GqlPageInfo;

expect(balances.length).toBe(10);
expect(pageInfo.hasNextPage).toBeTruthy();
expect(pageInfo.hasPreviousPage).toBeFalsy();
expect(pageInfo.startCursor).toBeDefined();
expect(pageInfo.endCursor).toBeDefined();

({ balances, pageInfo } = await provider.getBalances(wallet.address, {
after: pageInfo.endCursor,
}));

pageInfo = pageInfo as GqlPageInfo;

expect(balances.length).toBe(100);
expect(pageInfo.hasNextPage).toBeFalsy();
expect(pageInfo.hasPreviousPage).toBeTruthy();
expect(pageInfo.startCursor).toBeDefined();
expect(pageInfo.endCursor).toBeDefined();

({ balances, pageInfo } = await provider.getBalances(wallet.address, {
before: pageInfo.startCursor,
last: 10,
}));

pageInfo = pageInfo as GqlPageInfo;

expect(balances.length).toBe(10);
expect(pageInfo.hasNextPage).toBeFalsy();
expect(pageInfo.hasPreviousPage).toBeTruthy();
expect(pageInfo.startCursor).toBeDefined();
expect(pageInfo.endCursor).toBeDefined();
});

describe('pagination arguments', async () => {
using launched = await setupTestProviderAndWallets({
Expand Down Expand Up @@ -2259,11 +2263,11 @@ describe('Provider', () => {
invocation: () => provider.getBlocks(args),
limit: BLOCKS_PAGE_SIZE_LIMIT,
},
// {
// name: 'getBalances',
// invocation: () => provider.getBalances(address, args),
// limit: BALANCES_PAGE_SIZE_LIMIT,
// },
{
name: 'getBalances',
invocation: () => provider.getBalances(address, args),
limit: BALANCES_PAGE_SIZE_LIMIT,
},
];
}

Expand Down

0 comments on commit 6428260

Please sign in to comment.