Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Refactoring/Improve tests repository to remove boilerplate and simplify contract deployments #25

Open
@srinjoyc

Description

@srinjoyc

Currently, there is a lot of boilerplate involved in order to deploy all the contracts, get the available methods and pass this into tests. This includes things like:

export const mintKibble = async (recipient, amount) => {
	const Registry = await getRegistry();

	const name = "kibble/mint_tokens";
	const addressMap = {
		FungibleToken: Registry,
		Kibble: Registry,
	};
	const signers = [Registry];
	const args = [
		[recipient, Address],
		[amount, UFix64],
	];

	return sendTransaction({
		code,
		signers,
		args,
	});
	const code = await getTransactionCode({ name, addressMap });
...
}

The above shows how paths and contract addresses need to be mapped in order to run the transaction code.

This needs to be repeated to run any test and is quite repetitive. Since we know much of this information beforehand, we can abstract this away.

Potentially:

  • Use a generator to create a folder to host all the boilerplate code (module) so the tests can import from here and abstract a lot of it away.
  • Use a flow.test.json to define some of these settings/configs/accounts/contracts [maybe later]

Metadata

Metadata

Assignees

Labels

p-medMedium Priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions