Skip to content

[Test] Allow defining types or contracts locally in the test file itself #436

Open
@satyamakgec

Description

@satyamakgec

if I import a contract in a test file, it would not be able to resolve as it needs to be added in configuration, but it would not be possible as it is a static code written in the file itself.
ex -

foo.cdc <--- test file name

// Below are the contents of the foo.cdc
import Test
import Bar from ./Bar.cdc

fun setup() {
 ...
}

fun testFoo() {
   Bar.Abc()
}

.... End of Foo.cdc

// Below are the contents of Bar.cdc
pub contract Bar {
   pub struct Abc {
     ...
   }
}

In the above example I can't use Bar.Abc data type directly in the tests as I can't import the Bar in the Foo.cdc because of the configuration problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions