From fe6739a7364242a2523f3cf578fbb0ea42d0e87d Mon Sep 17 00:00:00 2001 From: John Wu <76966357+jwu-fisker@users.noreply.github.com> Date: Fri, 7 May 2021 15:27:14 -0700 Subject: [PATCH] CEC-231 Bulk car selection control (#38) * Bulk car selection control * Tweak control alignment --- .vscode/launch.json | 30 + src/components/App/App.test.js | 14 +- .../App/__snapshots__/App.test.js.snap | 865 ++++++++++-------- src/components/CarUpdates/Deploy/index.jsx | 80 +- src/components/Cars/CarSelection/index.jsx | 136 +++ src/components/Contexts/UpdatesContext.jsx | 2 +- .../Contexts/UpdatesContext.test.jsx | 2 +- src/components/Contexts/VehicleContext.jsx | 28 + .../Contexts/__mocks__/VehicleContext.jsx | 10 + src/components/Layouts/SideMenu.jsx | 4 +- .../__snapshots__/SideMenu.test.jsx.snap | 4 +- .../Create/__snapshots__/Create.test.js.snap | 16 +- src/components/useStyles.jsx | 9 + src/services/__mocks__/vehicles.js | 10 + src/services/vehicles.js | 27 +- 15 files changed, 743 insertions(+), 494 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 src/components/Cars/CarSelection/index.jsx diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7a61a6f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,30 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${file}" + }, + { + "name": "Debug CRA Tests", + "type": "node", + "request": "launch", + "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts", + "args": ["test", "--runInBand", "--no-cache", "--watchAll=false"], + "cwd": "${workspaceRoot}", + "protocol": "inspector", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "env": { "CI": "true" }, + "disableOptimisticBPs": true + } + ] +} \ No newline at end of file diff --git a/src/components/App/App.test.js b/src/components/App/App.test.js index f819255..2a898f9 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/App.test.js @@ -117,17 +117,12 @@ describe("App", () => { await check("/update/1", "h1", "Edit Update Package 1"); }); - it("Route /carupdate-deploy authenticated", async () => { - setToken(TEST_AUTH_OBJECT); - await check("/carupdate-deploy/1", "h1", "Deploy [1]"); - }); - it("Route /carupdate-status authenticated", async () => { setToken(TEST_AUTH_OBJECT); await check("/carupdate-status/1", "h1", ""); }); - it("Route /vehicles authenticated", async () => { + it("Route /vehicles authenticated", async () => { setToken(TEST_AUTH_OBJECT); await check("/vehicles", "h1", "Vehicles"); }); @@ -145,4 +140,9 @@ describe("App", () => { setToken(TEST_AUTH_OBJECT); await check("/page-not-found", "h1", "Page Not Found"); }); -}) \ No newline at end of file + + it("Route /carupdate-deploy authenticated", async () => { + setToken(TEST_AUTH_OBJECT); + await check("/carupdate-deploy/1", "h1", "Deploy [1]"); + }); +}); diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index e01a2c4..3d8e35f 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -6,17 +6,17 @@ exports[`App Route / authenticated 1`] = ` data-testid="mocked-userprovider" >
- Add Vehicles + Add Vehicle

- Add Vehicles + Add Vehicle
-
-

- Deploy - [1] -

-
+ +
+
- -
- -
-
-
- -
- -
-
-
- -
-