onflow / onflow/flow-cli

`flow test` should deploy smart contracts defined in flow.json

Open
#1,377 2 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

Feature Feedback
Dominant language
Go
Stars
209
Forks
87
Avg merge
1d 17h
Merged PRs (30d)
3

Description

Instructions

Issue To Be Solved

Currently we need to explicitly deploy a smart contract in the cadence unit or integration tests, e.g.:

import "FLIXRegistry"
...
...
access(all)
fun setup() {
    let flixRegistryErr = Test.deployContract(
        name: "FLIXRegistry",
        path: "../contracts/flix_registry.cdc",
        arguments: []
    )
...

In the above example FLIXRegistry cannot be referenced in the code before it was deployed with Test.deployContract, even if it is imported on the the top, and defined in the flow.json as follows:

{
  "contracts": {
    "FLIXRegistry": {
      "source": "cadence/contracts/flix_registry.cdc",
      "aliases": {
        "emulator": "0xf8d6e0586b0a20c7",
        "testing": "0x0000000000000007"
      }
    },
...
(Optional): Suggest A Solution

It could increase developer experience if smart contracts defined in the flow.json are readily available in the unit tests, so the developers only have to import those as dependencies.
Also it could keep the unit tests code more concise and clean.

(Optional): Context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.