diff --git a/package.json b/package.json index 789b9ca..6441d25 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "@testing-library/react": "^11.2.2", "@testing-library/user-event": "^12.6.0", "axios": "^0.21.1", + "clsx": "^1.1.1", "material-ui-dropzone": "^3.5.0", "react": "^17.0.1", "react-dom": "^17.0.1", diff --git a/src/components/App/App.test.js b/src/components/App/App.test.js index 150a38a..c816b0d 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/App.test.js @@ -1,5 +1,6 @@ jest.mock("../Contexts/UserContext"); jest.mock("../Contexts/FileUploadContext"); +jest.mock("../Contexts/VehicleContext"); import { render, screen, cleanup, waitForElementToBeRemoved } from "@testing-library/react"; import { setToken } from "../Contexts/UserContext"; @@ -26,27 +27,40 @@ describe("App", () => { it("Route / unauthenticated", async () => { const container = await renderRoute("/"); - expect(container.querySelector("h1").innerHTML).toEqual("Fisker OTA Portal"); + expect(container.querySelector("span.MuiButton-label").innerHTML).toEqual("Sign In"); expect(container).toMatchSnapshot(); }); it("Route /home unauthenticated", async () => { const container = await renderRoute("/home"); - expect(container.querySelector("h1").innerHTML).toEqual("Fisker OTA Portal"); + expect(container.querySelector("span.MuiButton-label").innerHTML).toEqual("Sign In"); + expect(container).toMatchSnapshot(); + }); + + it("Route /vehicle-add unauthenticated", async () => { + const container = await renderRoute("/vehicle-add"); + expect(container.querySelector("span.MuiButton-label").innerHTML).toEqual("Sign In"); expect(container).toMatchSnapshot(); }); it("Route / authenticated", async () => { setToken(TEST_TOKEN); const container = await renderRoute("/"); - expect(container.querySelector("h1").innerHTML).toEqual("Upload file"); + expect(container.querySelector("h1").innerHTML).toEqual("Upload Update Package"); expect(container).toMatchSnapshot(); }); it("Route /home authenticated", async () => { setToken(TEST_TOKEN); const container = await renderRoute("/home"); - expect(container.querySelector("h1").innerHTML).toEqual("Upload file"); + expect(container.querySelector("h1").innerHTML).toEqual("Upload Update Package"); + expect(container).toMatchSnapshot(); + }); + + it("Route /vehicle-add authenticated", async () => { + setToken(TEST_TOKEN); + const container = await renderRoute("/vehicle-add"); + expect(container.querySelector("h1").innerHTML).toEqual("Add Vehicle"); expect(container).toMatchSnapshot(); }); @@ -62,5 +76,4 @@ describe("App", () => { expect(container.querySelector("h1").innerHTML).toEqual("Page Not Found"); expect(container).toMatchSnapshot(); }); - }) \ No newline at end of file diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index 21b2926..f2b0a88 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -5,81 +5,440 @@ exports[`App Route / authenticated 1`] = `
-
-
-

- Upload file -

-
-
- - -
-
+ + + + + +
+ Fisker OTA Portal +
+
+ + -
+
+
+
+
+
+
+

+ Upload Update Package +

+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+