Skip to content

Commit

Permalink
ci: add optimized graphql query e2e tests (#3311)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad authored Oct 21, 2024
1 parent 2d21767 commit 9bb2002
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changeset/selfish-weeks-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
---
ci: add optimized graphql query e2e tests
49 changes: 48 additions & 1 deletion packages/fuel-gauge/src/e2e-script.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import { DEVNET_NETWORK_URL, TESTNET_NETWORK_URL } from '@internal/utils';
import { WalletUnlocked, Provider, TransactionType, CHAIN_IDS, rawAssets, assets } from 'fuels';
import { WalletUnlocked, Provider, TransactionType, CHAIN_IDS, rawAssets, assets, bn } from 'fuels';

import { ScriptMainArgBool } from '../test/typegen';

Expand Down Expand Up @@ -120,6 +120,53 @@ describe.each(selectedNetworks)('Live Script Test', (selectedNetwork) => {
15_000
);

describe('optimized graphql queries', () => {
it('should get the balance of the wallet', { timeout: 15_000 }, async () => {
if (shouldSkip) {
return;
}

const balance = await provider.getBalance(wallet.address, provider.getBaseAssetId());
expect(bn(balance).gt(0));
});

it('should get the chain and node info', { timeout: 15_000 }, async () => {
if (shouldSkip) {
return;
}

const chainInfo = await provider.fetchChainAndNodeInfo();
expect(chainInfo).toBeDefined();
});

it('should get latest block height', { timeout: 15_000 }, async () => {
if (shouldSkip) {
return;
}

const blockNumber = await provider.getBlockNumber();
expect(bn(blockNumber).gt(0));
});

it('should get the latest block', { timeout: 15_000 }, async () => {
if (shouldSkip) {
return;
}

const block = await provider.getBlock('latest');
expect(block).toBeDefined();
});

it('should get block with transactions', { timeout: 15_000 }, async () => {
if (shouldSkip) {
return;
}

const block = await provider.getBlockWithTransactions('latest');
expect(block).toBeDefined();
});
});

it(`should have correct assets`, () => {
if (shouldSkip) {
return;
Expand Down

0 comments on commit 9bb2002

Please sign in to comment.