Back to Fuels Ts

Basic Example

apps/docs/src/guide/testing/basic-example.md

0.103.01.0 KB
Original Source
<script setup> import { data } from '../../versions.data' const { forc } = data const url = `https://docs.fuel.network/docs/forc/commands/forc_test/` </script>

Basic Example

Let's use launchTestNode with the counter contract from the Fuel dApp tutorial.

Note: you will have to change the import paths of the contract factory and bytecode to match your folder structure.

<<< @./snippets/launching-a-test-node.ts#basic-example{ts:line-numbers}

Summary

  1. The launched variable was instantiated with the using keyword.
  2. launchTestNode spun up a short-lived fuel-core node, deployed a contract to it and returned it for testing.
  3. The deployed contract is fully typesafe because of launchTestNode's type-level integration with typegen outputs.
  4. Besides the contract, you've got the provider and wallets at your disposal.