-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Simulate events returning promises? #823
Copy link
Copy link
Closed
Labels
Description
Hi there - really enjoying the library! I have a question about testing simulate events. Many of the events in my code trigger functions that wait for promises.
onClick = async (e) => {
data = await fetchData(e.target.value)
this.setState({data})
}In the live react, events clearly don't return promises, but I'm not sure if enzyme's simulate is also event-driven. Is there a way that I can wait for a simulate event to return a promise? I know there is an alternative, but it's a little bit more overhead.
someFunc = async () => {
data = await fetchData(e.target.value)
this.setState({data})
}
onClick = (e) => {
someFunc()
}
// test onClick calls someFunc()
// test someFunc()Reactions are currently unavailable