cadence icon indicating copy to clipboard operation
cadence copied to clipboard

Allow defining types or contracts locally in the test file itself

Open satyamakgec opened this issue 3 years ago • 2 comments

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.

satyamakgec avatar Oct 18 '22 07:10 satyamakgec