Change main UI layout and add VINs to add and upload forms (#16)

* Add new upload update package form
Add new add vehicle form
Add new side menu layout
Add new toolbar layout
Update and add unit tests

* Enable add get and add vehicles

* Integration issues with ota_update service

* Update get vehicle JSON format

* Fix related unit test
Add release notes field

* Add StatusContext to display error and status messages
This commit is contained in:
John Wu
2021-03-11 12:53:29 -08:00
committed by GitHub
parent 39e779dc1d
commit 2e1f4a7a7c
31 changed files with 2666 additions and 377 deletions

View File

@@ -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();
});
})