Skip to content

Instantly share code, notes, and snippets.

@Waksuu
Created March 25, 2020 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Waksuu/326b50a5a6460361f1375fc2ca7be5d8 to your computer and use it in GitHub Desktop.
Save Waksuu/326b50a5a6460361f1375fc2ca7be5d8 to your computer and use it in GitHub Desktop.
describe("Movie Panel", () => {
let mockStore: Store<AppState, AppActions>;
let MoviePanelMock: FC;
beforeEach(() => {
mockStore = configureStore();
MoviePanelMock = connect(
mapStateToProps,
(dispatch: ThunkDispatch<AppState, undefined, AppActions>) =>
mapDispatchToProps(getAllMoviesMock)(dispatch)
)(MoviePanel);
});
afterEach(cleanup);
test("Should clear movies after pressing clear movies button", async () => {
// GIVEN
await render(
<Provider store={mockStore}>
<MoviePanelMock />
</Provider>
);
// WHEN
fireEvent.click(screen.getByTestId("clear-movies-button"));
// THEN
expect(screen.queryByTestId("movie-list-component")).toBeEmpty();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment