You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And the test introduced weird behaviours, after hour of debugging I realised the problem with my code, and to solve the problem I need to wrap the MorfiTestUtils.Field function with another functions that pass the props properly:
I didn't add type safety in first place, because it also adds a burden on the writer of a test that the provided function needs to fulfill the interface. That would make some "any" casts necessary in case you want to be less accurate.
However, also looking into the behavioral change of other test frameworks, it seems more beneficial to have it. As it would be a breaking change, I'll include it into the pending v4 release.
I was working on adding tests to react component, and the component basically called
FormSelectBranch
and it has the following props:So inside the test file I did:
And the test introduced weird behaviours, after hour of debugging I realised the problem with my code, and to solve the problem I need to wrap the
MorfiTestUtils.Field
function with another functions that pass the props properly:The expected behaviour:
I should get type error for the first code snippet
Suggested solution
We can update the types of SpyInstance to be more safe, something like this:
And we can do so for the other functions
The text was updated successfully, but these errors were encountered: