From d8db68f857b0d241fab2cc4a1e6edea394939de3 Mon Sep 17 00:00:00 2001 From: John Wu <76966357+jwu-fisker@users.noreply.github.com> Date: Wed, 9 Jun 2021 17:10:23 -0700 Subject: [PATCH] Merge Development (#53) * Use responsive iframe control for charts (#49) * Use responsive iframe control to charts * Move external Grafana link to Dashboard page * Remove unused embedded style class * Add button label * added delete button to deploy packages * Fix unit test warning Remove unused route from test * Fix styling of button * minor fixes per pr review Co-authored-by: jcw-fisker Co-authored-by: John Cotten Watson <83605808+jcw-fisker@users.noreply.github.com> --- src/components/App/App.test.js | 29 +- .../App/__snapshots__/App.test.js.snap | 4683 ++++++++--------- src/components/App/index.jsx | 2 +- src/components/Contexts/UpdatesContext.jsx | 21 + .../Contexts/__mocks__/UpdatesContext.jsx | 9 + src/components/UpdatePackages/List/index.jsx | 49 +- src/services/updates.js | 12 +- 7 files changed, 2200 insertions(+), 2605 deletions(-) diff --git a/src/components/App/App.test.js b/src/components/App/App.test.js index 86b9731..e4be513 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/App.test.js @@ -30,14 +30,14 @@ describe("App", () => { beforeAll(() => { // Stablize Table Pagination control ids expect.addSnapshotSerializer({ - test: function(val) { - return val && typeof val === "string" && val.indexOf("mui-") >= 0; + test: function (val) { + return val && typeof val === "string" && val.indexOf("mui-") >= 0; }, - print: function(val) { - let str = val; - str = str.replace(/mui-[0-9]*/g, "mui-00000"); - - return `"${str}"`; + print: function (val) { + let str = val; + str = str.replace(/mui-[0-9]*/g, "mui-00000"); + + return `"${str}"`; } }); }); @@ -67,10 +67,6 @@ describe("App", () => { await check("/updates", "span.MuiButton-label", "Sign In"); }); - it("Route /update unauthenticated", async () => { - await check("/update/1", "span.MuiButton-label", "Sign In"); - }); - it("Route /carupdate-deploy unauthenticated", async () => { await check("/carupdate-deploy/1", "span.MuiButton-label", "Sign In"); }); @@ -120,17 +116,12 @@ describe("App", () => { await check("/updates", "h6", "Deploy Packages"); }); - it("Route /update authenticated", async () => { - setToken(TEST_AUTH_OBJECT); - await check("/update/1", "h6", "Edit Update Package 1"); - }); - it("Route /carupdate-status authenticated", async () => { setToken(TEST_AUTH_OBJECT); - await check("/carupdate-status/1", "h6", ""); + await check("/carupdate-status/1", "h6", "Package Package 1.0"); }); - it("Route /vehicles authenticated", async () => { + it("Route /vehicles authenticated", async () => { setToken(TEST_AUTH_OBJECT); await check("/vehicles", "h6", "Vehicles"); }); @@ -156,7 +147,7 @@ describe("App", () => { it("Route /carupdate-deploy authenticated", async () => { setToken(TEST_AUTH_OBJECT); - await check("/carupdate-deploy/1", "h6", "Deploy "); + await check("/carupdate-deploy/1", "h6", "Deploy Package 1.0"); }); it("Route /dashboard authenticated", async () => { diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index 48a55c1..ab33c1a 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -6,10 +6,10 @@ exports[`App Route / authenticated 1`] = ` data-testid="mocked-userprovider" >
Fisker Admin Portal
@@ -212,16 +212,16 @@ exports[`App Route / authenticated 1`] = `

- Deploy + Deploy Package 1.0

Fisker Admin Portal
@@ -505,10 +505,10 @@ exports[`App Route /carupdate-deploy authenticated 1`] = `

Created - + Invalid Date Invalid Date . - No description + Description

0 Selected
@@ -602,7 +602,7 @@ exports[`App Route /carupdate-deploy authenticated 1`] = ` style="text-align: right;" >
VIN sorted ascending @@ -950,2451 +950,6 @@ exports[`App Route /carupdate-deploy authenticated 1`] = ` `; exports[`App Route /carupdate-deploy unauthenticated 1`] = ` -
-
-
-
-
-
-
-
-
-
-
-
-
-`; - -exports[`App Route /carupdate-status authenticated 1`] = ` -
- - - - - - - - - - - - - - - -
- ID - - Vehicle - - Status - - Created - - Updated -
-
-
-
-
-
-
- -`; - -exports[`App Route /carupdate-status unauthenticated 1`] = ` -
-
-
-
-
-
-
-
-
-
-
-
-
-`; - -exports[`App Route /dashboard authenticated 1`] = ` -
-
-
-
-
-
- Dashboard -
- -
-
- -
-
-
-
-
-