From aa43431d12d2d7886052bbb8705bb7500c2bd151 Mon Sep 17 00:00:00 2001 From: Paul Adamsen <117673433+pauladamseniii@users.noreply.github.com> Date: Thu, 18 May 2023 12:41:30 -0400 Subject: [PATCH] CEC-4157 - Add new statuses to car_update_progress (#334) * CEC-4157 - Add new statuses to car_update_progress * small fix --- .../App/__snapshots__/App.test.js.snap | 110 ++++++- .../Contexts/__mocks__/CarUpdatesContext.jsx | 60 +++- .../CarUpdateStatusProgress.test.jsx | 24 +- .../CarUpdateStatusProgress/Statuses.js | 2 + .../CarUpdateStatusProgress.test.jsx.snap | 284 ++++++++++++++++++ .../CarUpdateStatusProgress/index.jsx | 4 +- .../CarUpdateStatusTable.test.jsx.snap | 44 +++ 7 files changed, 524 insertions(+), 4 deletions(-) diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index 209f8f2..08c49aa 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -5411,6 +5411,114 @@ exports[`App Route /package-status authenticated 1`] = ` + + + 2 + + + + 1G1FP87S3GN100062 + + + + downloaded + + + 7/1/2021 10:40:07 PM + + + 7/12/2021 6:22:13 PM + + + + + + + + + + 3 + + + + 1G1FP87S3GN100062 + + + + downloaded + + + 7/1/2021 10:40:07 PM + + + 7/12/2021 6:22:13 PM + + + + + + + - 1-1 of 1 + 1-2 of 2

{ const renderCarUpdateStatusProgress = async (status) => { const { container } = render(); - await waitFor(() => {}); + await waitFor(() => { }); return container; }; @@ -144,6 +144,28 @@ describe("CarUpdateStatusProgress", () => { err: 0, }, }, + { + name: "install_scheduled", + status: { + car_update_id: 1, + ecu: "TEST", + installed: 5, + total_files: 10, + msg: s.InstallSucceeded, + err: 0, + }, + }, + { + name: "requirements_failed", + status: { + car_update_id: 1, + ecu: "TEST", + installed: 5, + total_files: 10, + msg: s.InstallFailed, + err: 0, + }, + }, ]; for (let i = 0, len = tests.length; i < len; i++) { const test = tests[i]; diff --git a/src/components/Controls/CarUpdateStatusProgress/Statuses.js b/src/components/Controls/CarUpdateStatusProgress/Statuses.js index fc9be48..a60d887 100644 --- a/src/components/Controls/CarUpdateStatusProgress/Statuses.js +++ b/src/components/Controls/CarUpdateStatusProgress/Statuses.js @@ -34,6 +34,8 @@ const Statuses = { PackageDownloadCompleted: "package_download_complete", PackageInstallStarted: "package_install_start", PackageInstallCompleted: "package_install_complete", + RequirementsFailed: "requirements_failed", + InstallScheduled: "install_scheduled", }; export default Statuses; diff --git a/src/components/Controls/CarUpdateStatusProgress/__snapshots__/CarUpdateStatusProgress.test.jsx.snap b/src/components/Controls/CarUpdateStatusProgress/__snapshots__/CarUpdateStatusProgress.test.jsx.snap index c037ba9..af4dcb1 100644 --- a/src/components/Controls/CarUpdateStatusProgress/__snapshots__/CarUpdateStatusProgress.test.jsx.snap +++ b/src/components/Controls/CarUpdateStatusProgress/__snapshots__/CarUpdateStatusProgress.test.jsx.snap @@ -994,6 +994,148 @@ exports[`CarUpdateStatusProgress Render install_error 1`] = `
`; +exports[`CarUpdateStatusProgress Render install_scheduled 1`] = ` +
+
+
+ +

+ Pending +

+
+
+ +

+ Received +

+
+
+ +

+ Precondition +

+
+
+ +

+ Download +

+
+
+ +

+ Approved +

+
+
+ +

+ Install +

+
+
+ +

+ Updated +

+
+
+
+`; + exports[`CarUpdateStatusProgress Render installing 1`] = `
`; + +exports[`CarUpdateStatusProgress Render requirements_failed 1`] = ` +
+
+
+ +

+ Pending +

+
+
+ +

+ Received +

+
+
+ +

+ Precondition +

+
+
+ +

+ Download +

+
+
+ +

+ Approved +

+
+
+ +

+ Install +

+
+
+ +

+ Updated +

+
+
+
+`; diff --git a/src/components/Controls/CarUpdateStatusProgress/index.jsx b/src/components/Controls/CarUpdateStatusProgress/index.jsx index 2131b30..6b9cd1d 100644 --- a/src/components/Controls/CarUpdateStatusProgress/index.jsx +++ b/src/components/Controls/CarUpdateStatusProgress/index.jsx @@ -56,9 +56,11 @@ const PHASES = [ s.Installing, s.InstallSucceeded, s.InstallFailed, + s.RequirementsFailed, + s.InstallScheduled, ], progress: (msg, progress) => { - if (msg === s.InstallFailed) return ErrorStatus; + if (msg === s.InstallFailed || msg === s.RequirementsFailed) return ErrorStatus; if (msg === s.PackageInstallCompleted) return CompleteStatus; return progress; }, diff --git a/src/components/Controls/CarUpdateStatusTable/__snapshots__/CarUpdateStatusTable.test.jsx.snap b/src/components/Controls/CarUpdateStatusTable/__snapshots__/CarUpdateStatusTable.test.jsx.snap index 5807971..1e588b0 100644 --- a/src/components/Controls/CarUpdateStatusTable/__snapshots__/CarUpdateStatusTable.test.jsx.snap +++ b/src/components/Controls/CarUpdateStatusTable/__snapshots__/CarUpdateStatusTable.test.jsx.snap @@ -175,6 +175,50 @@ exports[`CarUpdateStatusTable Render 1`] = ` class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" /> + + + 8/23/2021 5:06:38 PM + + + install_scheduled + + + TEST + + + + + + 8/23/2021 5:06:38 PM + + + requirements_failed + + + TEST + + +