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>
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user