Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: integrate launchTestNode in remaining packages #2811

Conversation

maschad
Copy link
Member

@maschad maschad commented Jul 21, 2024

Release notes

In this release, we:

  • Removed generateTestWallet, seedTestWallet and launchNodeAndGetWallets utilities

Summary

This PR integrates the launchTestNode utility in the remaining packages. The following packages were addressed

  • @fuel-ts/account
  • internal
  • program
  • script
  • fuels
  • create-fuels
  • apps
  • docs-snippets

Breaking Changes

Removed generateTestWallet and seedTestWallet utilities.

// before
import { bn } from "@fuel-ts/math";
import {
  seedTestWallet,
  generateTestWallet,
} from "@fuel-ts/account/test-utils";

const provider = await Provider.create("http://127.0.0.1:4000/v1/graphql");

// seeding
const walletA = Wallet.fromPrivateKey("0x...", provider);
const baseAssetId = provider.getBaseAssetId();
seedTestWallet(wallet, [{ assetId: baseAssetId, amount: bn(100_000) }]);

// generating
const walletB = await generateTestWallet(provider, [[1_000, baseAssetId]]);
// after
import { launchTestNode } from 'fuels/test-utils';

// create two wallets seeded with 100_000 units of the base asset
using launched = await launchTestNode({
  walletsConfig: {
    count: 2,
    amountPerCoin: 100_000,
  },
});

const {
  wallets: [walletA, walletB]
} = launched;

const balance = await walletA.getBalance() // 100_000

Removed launchNodeAndGetWallets utility.

// before
import { launchNodeAndGetWallets } from 'fuels/test-utils';

const { provider, wallets } = await launchNodeAndGetWallets();
// after
import { launchTestNode } from 'fuels/test-utils';

using launched = await launchTestNode();

const { provider, wallets } = launched;

Checklist

  • I addedtests to prove my changes
  • I updated — all the necessary docs
  • I reviewed — the entire PR myself, using the GitHub UI
  • I described — all breaking changes and the Migration Guide

@maschad maschad self-assigned this Jul 21, 2024
@github-actions github-actions bot added the chore Issue is a chore label Jul 21, 2024
@maschad maschad dismissed stale reviews from arboleya and petertonysmith94 via 8939ed9 August 14, 2024 18:12
@maschad
Copy link
Member Author

maschad commented Aug 14, 2024

Do we want to remove the following while we can?

  • launchNodeAndGetWallets
  • generateTestWallet
  • seedTestWallet

IMO they've been superseded by launchTestNode

8939ed9

@maschad maschad changed the title chore: integrate launchTestNode in remaining packages chore!: integrate launchTestNode in remaining packages Aug 14, 2024
@maschad maschad marked this pull request as draft August 14, 2024 19:27
@maschad maschad marked this pull request as ready for review August 14, 2024 20:34
Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
79.07%(-0.17%) 71.43%(-0.14%) 77.28%(-0.13%) 79.21%(-0.17%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/account.ts 84%
(+0%)
67.69%
(-1.54%)
85.29%
(+0%)
83.66%
(+0%)
🔴 packages/account/src/providers/provider.ts 68%
(-0.53%)
60.54%
(-1.62%)
72.28%
(-1.21%)
67.96%
(-0.52%)
🔴 packages/account/src/test-utils/launchNode.ts 93.13%
(-5.14%)
85.96%
(-0.92%)
100%
(+0%)
93.45%
(-4.91%)
packages/account/src/test-utils/setup-test-provider-and-wallets.ts 100%
(+20%)
100%
(+10%)
100%
(+33.34%)
100%
(+20%)

@petertonysmith94 petertonysmith94 merged commit 5e8a087 into master Aug 15, 2024
25 checks passed
@petertonysmith94 petertonysmith94 deleted the mc/chore/integrate-launch-test-node-in-remaining-packages branch August 15, 2024 11:26
maschad added a commit that referenced this pull request Aug 21, 2024
* refactor: integrated launchTestNode in remaining files

* docs: update changeset

* test: integrated launchTestNode into all tests excluding doc-snippets

* wip

* test: refactored many tests in docs-snippets

* test: skipping currently failing test suites for ci tests

* docs: add changeset

* deps: update dependencies

* deps: remove cyclical dependency

* deps: updated dependencies to use setupTestWallet for now

* fix: add error handling for in memory store historical view issues

* test: enable browser for demo-fuels index test

* docs: added comments about typegen contract call mismatches

* revert error supression on provider

* test: increasing block production time

* test: browser test adjusments

* test: browser test adjustments

* test: update provider test case for snippets

* chore: refactor to use new typegen types

* linting

* chore: resolve issue with account tests

* chore: undo create-fuels.js change

* chore: update poa-interval-period

* chore: update querying chain docs tests

* test: update FUEL_CORE compatability tests

* linting fixes

* docs: use custom port for launchTestNode

* docs: update docs with PR feedback

* chore: remove unused testing utilities

* chore: more PR feedback refactors

* ci: update CI workflow test scripts

* ci: update workflow steps

* test: update tests to spin up temp nodes in setup

* linting

* docs: update changesets

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>

* chore: update variable assignment

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>

* docs: update imports

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>

* chore: pr feedback changes

* docs: re-introduce testing wallets docs (#2635)

Co-authored-by: Anderson Arboleya <anderson@arboleya.me>

* chore: update changesets + feedback

* ci: remove unnecessary clean step

* docs: update contributing docs

* chore: update test asset IDs

* chore: refactor account tests to use helper

* chore: pr feedback

* docs: update changesets

* docs: update changeset to breaking

* docs: remove unnecessary updates from changeset

---------

Co-authored-by: Sérgio Torres <30977845+Torres-ssf@users.noreply.github.com>
Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>
Co-authored-by: Anderson Arboleya <anderson@arboleya.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate launchTestNode in remaining packages Reintroduce Wallet testing documentation
6 participants