Closed Dregorio1 closed 1 year ago
mount
doesn't mock anything, so i'm not sure where you're getting that. Certainly renderer
should contain the results of MyComponent
.
I don't know what waitForExpect
is for either.
@ljharb waitForExpect
is because I wanted to wait on "call" to API. renderer
has MyComponent and AsyncSelect
but AsyncSelect
has no data in it. Somewhere I have read that if I mock result from the function in my MyComponent
mount
will embed that data.
The best way to wait on an API call is to mock it and get the actual promise that the component itself is waiting on.
@ljharb I mocked it in beforeEach
. Did you suggest something else? How should I do that? Any snippet will be great.
I know you did - but that doesn't capture the promise it produces.
I'm afraid I don't have time to figure out a snippet for it. Generally I'd suggest exhausting your testing options with shallow
before resorting to mount
, if you haven't already done so.
I have code:
If I understand document correctly
mount
function should embed data from the mock. But when I run the last lineselectName.props().onChange({ target: { value: 'Roberto' } });
it said that has no target value and when I use therelength
I have got 0. It is something wrong withmount
, my code, ornock
?