Skip to content

Commit

Permalink
Merge branch 'master' into YaTut1901/feature/update-onDeploy-callback
Browse files Browse the repository at this point in the history
  • Loading branch information
petertonysmith94 authored Nov 14, 2024
2 parents 287a170 + 0585ee4 commit 69bb8d9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .changeset/orange-panthers-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: use typegen'd outputs in some fuel-gauge tests
6 changes: 3 additions & 3 deletions packages/fuel-gauge/src/advanced-logging.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FuelError } from '@fuel-ts/errors';
import { Script, bn } from 'fuels';
import { bn } from 'fuels';
import { launchTestNode } from 'fuels/test-utils';

import {
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('Advanced Logging', () => {
wallets: [wallet],
} = launched;

const script = new Script(ScriptCallContract.bytecode, ScriptCallContract.abi, wallet);
const script = new ScriptCallContract(wallet);

const { waitForResult } = await script.functions
.main(advancedLogContract.id.toB256(), otherAdvancedLogContract.id.toB256(), amount)
Expand All @@ -305,7 +305,7 @@ describe('Advanced Logging', () => {
wallets: [wallet],
} = launched;

const script = new Script(ScriptCallContract.bytecode, ScriptCallContract.abi, wallet);
const script = new ScriptCallContract(wallet);

const request = await script.functions
.main(advancedLogContract.id.toB256(), otherAdvancedLogContract.id.toB256(), amount)
Expand Down
34 changes: 10 additions & 24 deletions packages/fuel-gauge/src/predicate/predicate-configurables.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getRandomB256, WalletUnlocked, Predicate, FuelError } from 'fuels';
import { getRandomB256, WalletUnlocked, FuelError } from 'fuels';
import { expectToThrowFuelError, launchTestNode } from 'fuels/test-utils';

import { PredicateTrue, PredicateWithConfigurable } from '../../test/typegen';
Expand Down Expand Up @@ -26,9 +26,7 @@ describe('Predicate', () => {
wallets: [wallet],
} = launched;

const predicate = new Predicate({
abi: PredicateWithConfigurable.abi,
bytecode: PredicateWithConfigurable.bytecode,
const predicate = new PredicateWithConfigurable({
provider: wallet.provider,
data: [defaultValues.FEE, defaultValues.ADDRESS], // set predicate input data to be the same as default configurable value
});
Expand Down Expand Up @@ -69,9 +67,7 @@ describe('Predicate', () => {
const configurableConstants = { FEE: 35 };

expect(configurableConstants.FEE).not.toEqual(defaultValues.FEE);
const predicate = new Predicate({
abi: PredicateWithConfigurable.abi,
bytecode: PredicateWithConfigurable.bytecode,
const predicate = new PredicateWithConfigurable({
provider,
data: [configurableConstants.FEE, defaultValues.ADDRESS],
configurableConstants,
Expand Down Expand Up @@ -114,9 +110,7 @@ describe('Predicate', () => {
const configurableConstants = { ADDRESS: getRandomB256() };

expect(configurableConstants.ADDRESS).not.toEqual(defaultValues.ADDRESS);
const predicate = new Predicate({
abi: PredicateWithConfigurable.abi,
bytecode: PredicateWithConfigurable.bytecode,
const predicate = new PredicateWithConfigurable({
provider,
data: [defaultValues.FEE, configurableConstants.ADDRESS],
configurableConstants,
Expand Down Expand Up @@ -163,9 +157,7 @@ describe('Predicate', () => {

expect(configurableConstants.FEE).not.toEqual(defaultValues.FEE);
expect(configurableConstants.ADDRESS).not.toEqual(defaultValues.ADDRESS);
const predicate = new Predicate({
abi: PredicateWithConfigurable.abi,
bytecode: PredicateWithConfigurable.bytecode,
const predicate = new PredicateWithConfigurable({
provider,
data: [configurableConstants.FEE, configurableConstants.ADDRESS],
configurableConstants,
Expand Down Expand Up @@ -245,9 +237,7 @@ describe('Predicate', () => {
wallets: [wallet],
} = launched;

const predicate = new Predicate({
abi: PredicateWithConfigurable.abi,
bytecode: PredicateWithConfigurable.bytecode,
const predicate = new PredicateWithConfigurable({
provider,
});

Expand All @@ -269,11 +259,9 @@ describe('Predicate', () => {

await expectToThrowFuelError(
() =>
new Predicate({
bytecode: PredicateTrue.bytecode,
abi: PredicateTrue.abi,
new PredicateTrue({
provider,
data: ['NADA'],
// @ts-expect-error testing invalid configurable
configurableConstants: {
constant: 'NADA',
},
Expand All @@ -292,12 +280,10 @@ describe('Predicate', () => {

await expectToThrowFuelError(
() =>
new Predicate({
bytecode: PredicateWithConfigurable.bytecode,
abi: PredicateWithConfigurable.abi,
new PredicateWithConfigurable({
provider,
data: ['NADA'],
configurableConstants: {
// @ts-expect-error testing invalid configurable
NOPE: 'NADA',
},
}),
Expand Down

0 comments on commit 69bb8d9

Please sign in to comment.