diff --git a/src/components/App/App.test.js b/src/components/App/App.test.js index 67ca594..1068b72 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/App.test.js @@ -1,4 +1,5 @@ jest.mock("../Contexts/UserContext"); +jest.mock("../Contexts/FileUploadContext"); import { render, screen, cleanup, waitForElementToBeRemoved, waitFor } from "@testing-library/react" import { setToken } from "../Contexts/UserContext"; diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index a8a7e6f..f4284ec 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -16,65 +16,69 @@ exports[`App Route / authenticated 1`] = ` > Upload file -
+ +
+ +
+

+ Drag and drop a file here or click +

+ +
+
+
+ +
- -
-

- Drag and drop a file here or click -

- -
+ Sign Out + + +
-
-
- -
-
- +
@@ -245,65 +249,69 @@ exports[`App Route /home authenticated 1`] = ` > Upload file -
+ +
+ +
+

+ Drag and drop a file here or click +

+ +
+
+
+ +
- -
-

- Drag and drop a file here or click -

- -
+ Sign Out + + +
-
-
- -
-
- +
@@ -474,65 +482,69 @@ exports[`App Route /signup authenticated 1`] = ` > Upload file -
+ +
+ +
+

+ Drag and drop a file here or click +

+ +
+
+
+ +
- -
-

- Drag and drop a file here or click -

- -
+ Sign Out + + +
-
-
- -
-
- +
diff --git a/src/components/Routes/SiteRoutes.jsx b/src/components/Routes/SiteRoutes.jsx index 5b3fc89..f269c39 100644 --- a/src/components/Routes/SiteRoutes.jsx +++ b/src/components/Routes/SiteRoutes.jsx @@ -21,7 +21,7 @@ const SiteRoutes = () => { } type={TYPES.GUEST} token={token} /> } type={TYPES.GUEST} token={token} /> - } type={TYPES.PUBLIC} token={token} /> + } type={TYPES.PROTECTED} token={token} /> diff --git a/src/components/contexts/__mocks__/FileUploadContext.jsx b/src/components/contexts/__mocks__/FileUploadContext.jsx new file mode 100644 index 0000000..ca3d223 --- /dev/null +++ b/src/components/contexts/__mocks__/FileUploadContext.jsx @@ -0,0 +1,21 @@ +import React from "react"; + +let uploading = false; +let progress = 0; +let status = null; + +export const FileUploadProvider = ({ children }) => { + return ( +
+ {children} +
+ ); +}; + +export const useFileUploadContext = () => ({ + uploading, + progress, + status, + upload: jest.fn(), + cancel: jest.fn(), +});