Release/0.0.3 to main (#254)

* CEC-2628 - Display IP in digital twin in portal (#251)

* CEC-3453 Update security dll instructions (#252)

* CEC-2752-Add-Mobile-Issue-Tracker (#250)

* first commit

* removed comments

* remove more comments

* fix build issues

* fix unused vars

* update snapshot

* fix test

* Fix connect ECONNREFUSED 127.0.0.1:80

* Test Magna side menu

* attempt to pass test

* fix test

* remove comments

* fix some code smells

* fix test

* resolve comments

* fix bug

* resolved comments

* resolve comments

* resolve comments

* update snapshot

* resolved comments

Co-authored-by: jwu-fisker <jwu@fiskerinc.com>

* Cec 2752 small fix (#253)

* first commit

* removed comments

* remove more comments

* fix build issues

* fix unused vars

* update snapshot

* fix test

* Fix connect ECONNREFUSED 127.0.0.1:80

* Test Magna side menu

* attempt to pass test

* fix test

* remove comments

* fix some code smells

* fix test

* resolve comments

* fix bug

* resolved comments

* resolve comments

* resolve comments

* update snapshot

* resolved comments

* small fix

Co-authored-by: jwu-fisker <jwu@fiskerinc.com>

Co-authored-by: Paul Adamsen <117673433+pauladamseniii@users.noreply.github.com>
Co-authored-by: das31 <31259710+das31@users.noreply.github.com>
This commit is contained in:
John Wu
2023-01-10 18:30:39 -08:00
committed by GitHub
parent cf6ff831d7
commit b80a2cb8bf
29 changed files with 3056 additions and 140 deletions

View File

@@ -3,9 +3,12 @@ jest.mock("../Contexts/FileUploadContext");
jest.mock("../Contexts/VehicleContext");
jest.mock("../Contexts/ManifestsContext");
jest.mock("../Contexts/UserContext");
jest.mock("../Contexts/IssueContext");
jest.mock("../../services/monitoring");
jest.mock("../../services/vehiclesAPI");
jest.mock("../../services/superset")
jest.mock("../../services/superset");
jest.mock("../../services/suppliersAPI");
jest.mock("../../services/issueAPI");
import {
act, cleanup, render,
@@ -39,13 +42,14 @@ const check = async (path, selector, compare) => {
const sleepAndCheck = async (path, selector, compare) => {
const container = await renderRoute(path);
await waitFor(() => {});
await waitFor(() => { });
expect(container.querySelector(selector).innerHTML).toEqual(compare);
expect(container).toMatchSnapshot();
};
describe("App", () => {
beforeAll(() => {
global.URL.createObjectURL = jest.fn();
addSnapshotSerializer(expect);
}, 60000);
@@ -78,6 +82,14 @@ describe("App", () => {
await check("/vehicle-add", "span.MuiButton-label", "Sign In");
});
it("Route /issues unauthenticated", async () => {
await check("/issues", "span.MuiButton-label", "Sign In");
});
it("Route /issue-info unauthenticated", async () => {
await check("/issue-info/FISKER123", "span.MuiButton-label", "Sign In");
});
it("Route /vehicles unauthenticated", async () => {
await check("/vehicles", "span.MuiButton-label", "Sign In");
});
@@ -158,6 +170,17 @@ describe("App", () => {
await check("/vehicles", "h6", "Vehicles");
});
it("Route /issues authenticated", async () => {
setToken(TEST_AUTH_OBJECT_FISKER);
await check("/issues", "h6", "Issues");
});
it("Route /issue-info authenticated", async () => {
setToken(TEST_AUTH_OBJECT_FISKER);
await check("/issue-info/FISKER123", "h6", "Issue FISKER123 Details");
});
it("Route /vehicle-status authenticated", async () => {
setToken(TEST_AUTH_OBJECT_FISKER);
await check("/vehicle-status/FISKER123", "h6", "Vehicle FISKER123 Details");