Skip to content

Commit

Permalink
refactor: PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Jul 17, 2024
1 parent 1083c0c commit 755f8e0
Show file tree
Hide file tree
Showing 29 changed files with 94 additions and 518 deletions.
42 changes: 7 additions & 35 deletions apps/demo-typegen/src/demo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ import { ScriptAbi__factory } from './script-types';
*/
describe('ExampleContract', () => {
it('with imported storage slots', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 500_000,
},
});
using launched = await launchTestNode({});

const {
wallets: [wallet],
Expand All @@ -38,11 +34,7 @@ describe('ExampleContract', () => {
expect(contract.id).toBeTruthy();
});
it('should return the input', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 500_000,
},
});
using launched = await launchTestNode({});

const {
wallets: [wallet],
Expand Down Expand Up @@ -73,11 +65,7 @@ describe('ExampleContract', () => {
});

it('deployContract method', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 500_000,
},
});
using launched = await launchTestNode({});

const {
wallets: [wallet],
Expand All @@ -104,11 +92,7 @@ describe('ExampleContract', () => {
// #endregion Testing-in-ts-ts

it('should throw when simulating via contract factory with wallet with no resources', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 500_000,
},
});
using launched = await launchTestNode({});

const {
provider,
Expand All @@ -128,11 +112,7 @@ it('should throw when simulating via contract factory with wallet with no resour
});

it('should not throw when dry running via contract factory with wallet with no resources', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 500_000,
},
});
using launched = await launchTestNode({});

const {
provider,
Expand All @@ -149,11 +129,7 @@ it('should not throw when dry running via contract factory with wallet with no r
});

test('Example script', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 500_000,
},
});
using launched = await launchTestNode({});

const {
wallets: [wallet],
Expand All @@ -175,11 +151,7 @@ test('Example predicate', async () => {
// #context import { PredicateAbi__factory } from './types';

// In this exchange, we are first transferring some coins to the predicate
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 500_000,
},
});
using launched = await launchTestNode({});

const {
provider,
Expand Down
11 changes: 0 additions & 11 deletions packages/fuel-gauge/src/advanced-logging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ describe('Advanced Logging', () => {
{ deployer: ConfigurableContractAbi__factory, bytecode: ConfigurableContractAbiHex },
{ deployer: CoverageContractAbi__factory, bytecode: CoverageContractAbiHex },
],
walletsConfig: {
amountPerCoin: 500_000,
},
});

const {
Expand Down Expand Up @@ -288,8 +285,6 @@ describe('Advanced Logging', () => {
amount,
];

beforeAll(async () => {});

it('when using InvocationScope', async () => {
using launched = await launchTestNode({
contractsConfigs: [
Expand All @@ -299,9 +294,6 @@ describe('Advanced Logging', () => {
bytecode: AdvancedLoggingOtherContractAbiHex,
},
],
walletsConfig: {
amountPerCoin: 300_000,
},
});

const {
Expand Down Expand Up @@ -334,9 +326,6 @@ describe('Advanced Logging', () => {
bytecode: AdvancedLoggingOtherContractAbiHex,
},
],
walletsConfig: {
amountPerCoin: 300_000,
},
});

const {
Expand Down
12 changes: 2 additions & 10 deletions packages/fuel-gauge/src/await-execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ describe('await-execution', () => {
});

test.skip('transferring funds with awaitExecution works', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 1_000_000,
},
});
using launched = await launchTestNode({});

const { provider } = launched;

Expand All @@ -66,11 +62,7 @@ describe('await-execution', () => {
});

test('withdrawToBaseLayer works with awaitExecution', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 1_000_000,
},
});
using launched = await launchTestNode({});

const {
provider,
Expand Down
9 changes: 1 addition & 8 deletions packages/fuel-gauge/src/bytes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ describe('Bytes Tests', () => {
bytecode: BytesAbiHex,
},
],
walletsConfig: {
amountPerCoin: 1_000_000,
},
});

const {
Expand Down Expand Up @@ -153,11 +150,7 @@ describe('Bytes Tests', () => {
});

it('should test bytes input [script-bytes]', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 500_000,
},
});
using launched = await launchTestNode({});

const {
wallets: [wallet],
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-gauge/src/configurable-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const defaultValues = {
},
};

async function setupContract(configurableConstants?: { [name: string]: unknown }) {
function setupContract(configurableConstants?: { [name: string]: unknown }) {
return launchTestNode({
contractsConfigs: [
{
Expand Down
38 changes: 13 additions & 25 deletions packages/fuel-gauge/src/contract-factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ describe('Contract Factory', () => {
});

it('should not override user input maxFee when calling deployContract', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 5_000_000,
},
});
using launched = await launchTestNode({});
const {
wallets: [wallet],
} = launched;
Expand Down Expand Up @@ -137,24 +133,24 @@ describe('Contract Factory', () => {
storageSlots: StorageTestContractAbi__factory.storageSlots,
});

const { waitForResult } = await contract.functions.return_var1().call();
const { value: var1 } = await waitForResult();
const call1 = await contract.functions.return_var1().call();
const { value: var1 } = await call1.waitForResult();
expect(var1.toHex()).toEqual(toHex(0));

const { waitForResult: waitForSecondResult } = await contract.functions.return_var2().call();
const { value: var2 } = await waitForSecondResult();
const call2 = await contract.functions.return_var2().call();
const { value: var2 } = await call2.waitForResult();
expect(var2).toEqual(20);

const { waitForResult: waitForThirdResult } = await contract.functions.return_var3().call();
const { value: var3 } = await waitForThirdResult();
const call3 = await contract.functions.return_var3().call();
const { value: var3 } = await call3.waitForResult();
expect(var3).toEqual(30);

const { waitForResult: waitForFourthResult } = await contract.functions.return_var4().call();
const { value: var4 } = await waitForFourthResult();
const call4 = await contract.functions.return_var4().call();
const { value: var4 } = await call4.waitForResult();
expect(var4).toEqual(true);

const { waitForResult: waitForFifthResult } = await contract.functions.return_var5().call();
const { value: var5 } = await waitForFifthResult();
const call5 = await contract.functions.return_var5().call();
const { value: var5 } = await call5.waitForResult();
expect(JSON.stringify(var5)).toEqual(
JSON.stringify({
v1: true,
Expand All @@ -164,11 +160,7 @@ describe('Contract Factory', () => {
});

it('Creates a contract with initial storage (dynamic key)', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 5_000_000,
},
});
using launched = await launchTestNode({});
const {
wallets: [wallet],
} = launched;
Expand All @@ -192,11 +184,7 @@ describe('Contract Factory', () => {
});

it('Creates a contract with initial storage. Both dynamic key and fixed vars', async () => {
using launched = await launchTestNode({
walletsConfig: {
amountPerCoin: 5_000_000,
},
});
using launched = await launchTestNode({});
const {
wallets: [wallet],
} = launched;
Expand Down
Loading

0 comments on commit 755f8e0

Please sign in to comment.