Open birdofpreyru opened 1 month ago
Does not seem to solve the problem.
Perhaps, the problem in that test is that it snapshots a component tree with an async split chunk in it, thus no matter act() or not in the snapshot() method, if we don't wait specifically for split component pending promise, it has no effect?
Perhaps revert changes done in af2e6fb?
Agh... I guess, the actual solution here is to have a second, optional argument to the snapshot()
— snapshot options; and if we need to do async act()
waiting for something before considering the render completed, pass a promise to wait as an option there, take it if present wait for it.
And then the problematic tests in react-starter has to be correctly wrapped into the frontend RU app init logic (it needs global state provider, router, etc.), but that is a different problem.
Done, but it is to be verified if the update solves the root problem.
(See
__tests__/shared/routes/index.tsx
inreact-starter
, which usessnapshot()
and gets a warning from React aboutact()
missing).https://github.com/birdofpreyru/react-utils/blob/a137781e93905865100a95dee1aa7a447d845d56/src/shared/utils/jest/index.tsx#L104
also perhaps we need an option to automatically add client side initialization (wrapping provided component with the global state and router providers)