chore(test): rewritten forgot password page test using rtl (#4888)

This commit is contained in:
Tharun Rajendran 2022-03-31 22:20:30 +05:30 committed by GitHub
parent 4fdb9687ef
commit 661f48419f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,14 +1,16 @@
import React from "react";
import { mount } from "enzyme";
import { render } from "@testing-library/react";
import ConnectedPage, { ResetPasswordPage } from "./ResetPasswordPage";
import testHelpers from "../../test/helpers";
describe("ResetPasswordPage - component", () => {
it("renders a ResetPasswordForm", () => {
const page = mount(<ResetPasswordPage token="ABC123" />);
const { container } = render(<ResetPasswordPage token="ABC123" />);
expect(page.find("ResetPasswordForm").length).toEqual(1);
expect(container.querySelectorAll(".reset-password-form").length).toEqual(
1
);
});
it("Redirects to the login page when there is no token or user", () => {
@ -31,7 +33,7 @@ describe("ResetPasswordPage - component", () => {
};
const mockStore = reduxMockStore(store);
mount(connectedComponent(ConnectedPage, { mockStore }));
render(connectedComponent(ConnectedPage, { mockStore }));
const dispatchedActions = mockStore.getActions();