-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(dev-deps): fix React v18 dependancy error * test(utils): override @testing-library/react render method * test(app): import @testing-library/react methods from override util
- Loading branch information
1 parent
bef1a20
commit a24d77d
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
import { render as rtlRender } from "@testing-library/react"; | ||
import { configureStore } from "@reduxjs/toolkit"; | ||
import { Provider } from "react-redux"; | ||
|
||
import controlSystemReducer from "../../redux/state/controlSystem"; | ||
import webXPanelReducer from "../../redux/state/webXPanel"; | ||
|
||
function render( | ||
ui: React.ReactElement, | ||
{ | ||
store = configureStore({ | ||
reducer: { | ||
controlSystem: controlSystemReducer, | ||
webXPanel: webXPanelReducer, | ||
}, | ||
}), | ||
...renderOptions | ||
} = {}, | ||
) { | ||
function Wrapper({ children }: { children: React.ReactNode }) { | ||
return <Provider store={store}>{children}</Provider>; | ||
} | ||
|
||
return rtlRender(ui, { wrapper: Wrapper, ...renderOptions }); | ||
} | ||
|
||
export * from "@testing-library/react"; | ||
|
||
export { render }; |