diff --git a/src/components/SignInForm/__snapshots__/index.test.jsx.snap b/src/components/SignInForm/__snapshots__/index.test.jsx.snap new file mode 100644 index 0000000..e99b269 --- /dev/null +++ b/src/components/SignInForm/__snapshots__/index.test.jsx.snap @@ -0,0 +1,145 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Sign In Form Should render 1`] = ` +
+
+
+

+ Sign in +

+
+
+ +
+ + +
+
+
+ +
+ + +
+
+ + +
+
+
+
+`; diff --git a/src/components/SignInForm/index.test.jsx b/src/components/SignInForm/index.test.jsx new file mode 100644 index 0000000..02d2af9 --- /dev/null +++ b/src/components/SignInForm/index.test.jsx @@ -0,0 +1,15 @@ +import React from "react"; +import { BrowserRouter } from 'react-router-dom'; +import {render, cleanup, screen, fireEvent, waitFor} from "@testing-library/react" +jest.mock("../Contexts/UserContext"); +import { useUserContext, UserProvider } from "../Contexts/UserContext"; +import SignInForm from './index'; + +describe("Sign In Form", () => { + + it("Should render", () => { + const { container } = render(); + expect(container).toMatchSnapshot(); + cleanup(); + }) +}) \ No newline at end of file diff --git a/src/components/contexts/__mocks__/UserContext.jsx b/src/components/contexts/__mocks__/UserContext.jsx new file mode 100644 index 0000000..1968079 --- /dev/null +++ b/src/components/contexts/__mocks__/UserContext.jsx @@ -0,0 +1,19 @@ +import React from 'react'; + +export const UserProvider = ({ children }) => { + return ( +
+ {children} +
+ ); +}; + +export const useUserContext = () => ({ + fetching: false, + token: null, + error: null, + setError: jest.fn(), + signIn: jest.fn(), + signUp: jest.fn(), + signOut: jest.fn(), +});