+ Issue Details +
++ + ID + + : + FISKER123 +
++ + VIN + + : + 1GNGC26RXXJ407648 +
++ + Title + + : + sometitle +
++ + Description + + : + 2343242 +
++ + timestamp + + : + 2022-12-09T23:16:38.074858Z +
+diff --git a/src/components/App/App.test.js b/src/components/App/App.test.js index 0eab94a..b118fc8 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/App.test.js @@ -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"); diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index 6d15848..348551e 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -173,6 +173,42 @@ exports[`App Route / authenticated 1`] = ` /> +
+ + ID + + : + FISKER123 +
++ + VIN + + : + 1GNGC26RXXJ407648 +
++ + Title + + : + sometitle +
++ + Description + + : + 2343242 +
++ + timestamp + + : + 2022-12-09T23:16:38.074858Z +
++ + Note: Your email address will be used as the user id + +
+| + + Id + + + | ++ + VIN + + + | ++ + Title + + + | ++ + Description + + + | ++ + Driver ID + + + | ++ + Created + + sorted ascending + + + + | ++ |
|---|---|---|---|---|---|---|
| + + 15 + + | ++ 4Y1SL65848Z411439 + | ++ sometitle + | ++ 2343242 + | ++ 12345 + | ++ 12/9/2022 11:16:38 PM + | +|
| + + 17 + + | ++ 1GNGC26RXXJ407648 + | ++ sometitle + | ++ 2343242 + | ++ valid-cognito-id-1 + | ++ 12/9/2022 11:16:38 PM + | +|
| + + | +||||||
+ + Note: Your email address will be used as the user id + +
++ No Car Updates found +
diff --git a/src/components/Cars/Status/__snapshots__/DigitalTwinTab.test.jsx.snap b/src/components/Cars/Status/__snapshots__/DigitalTwinTab.test.jsx.snap index 607b45f..7340395 100644 --- a/src/components/Cars/Status/__snapshots__/DigitalTwinTab.test.jsx.snap +++ b/src/components/Cars/Status/__snapshots__/DigitalTwinTab.test.jsx.snap @@ -130,6 +130,17 @@ exports[`DigitalTwinTab Render 1`] = ` 1000000 ++ + Trex IP + + : + 172.20.0.17:49850 +
+