jeffbski / redux-logic

Redux middleware for organizing all your business logic. Intercept actions and perform async processing.
MIT License
1.81k stars 107 forks source link

warnTimeout: 0 and store.whenComplete() #54

Open lstkz opened 7 years ago

lstkz commented 7 years ago

I am using redux-logic-test for testing. I have a logic that initializes the socket and dispatches actions. warnTimeout is set to 0.

In my unit tests, I call await store.whenComplete(), but it causes timeouts because the logic never calls the done() callback.

If I call done(), all actions are ignored when I call dispatch({...}). Is there any workaround for this?

lstkz commented 7 years ago

Instead of calling await store.whenComplete(), I add a small delay await Promise.delay(10), and it solves this issue. Or jest.runTimersToTime(10) when using a jest framework.