Skip to content

Commit

Permalink
add test to validate getBalancesV1
Browse files Browse the repository at this point in the history
  • Loading branch information
Torres-ssf committed Jan 22, 2025
1 parent d2c55af commit fa363cb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/account/src/providers/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,34 @@ describe('Provider', () => {
expect(pageInfo.endCursor).toBeDefined();
});

it('can get balances [V1]', async () => {
vi.spyOn(Provider.prototype, 'fetchChainAndNodeInfo').mockImplementationOnce(async () =>
Promise.resolve({
nodeInfo: { nodeVersion: '0.40.0' } as NodeInfo,
chain: {} as ChainInfo,
})
);

using launched = await setupTestProviderAndWallets();
const {
provider,
wallets: [wallet],
} = launched;

const spy = vi.spyOn(provider.operations, 'getBalances');

const { pageInfo } = await wallet.getBalances();

expect(spy).toHaveBeenCalledWith({
first: 10000,
filter: { owner: wallet.address.toB256() },
});

expect(pageInfo).not.toBeDefined();

vi.restoreAllMocks();
});

describe('pagination arguments', async () => {
using launched = await setupTestProviderAndWallets({
walletsConfig: {
Expand Down

0 comments on commit fa363cb

Please sign in to comment.