From e09ce9bd411cd5859a1dec333a5759a2b65e96dc Mon Sep 17 00:00:00 2001 From: Drew Taylor Date: Wed, 21 Jul 2021 17:15:34 -0700 Subject: [PATCH] passing react tests --- src/assets/green-car.png | Bin 0 -> 676 bytes src/assets/red-car.png | Bin 0 -> 648 bytes src/components/App/App.test.js | 13 +- .../App/__snapshots__/App.test.js.snap | 736 ++++++++++++------ src/components/CarUpdates/Status/index.jsx | 4 +- .../Cars/CarSelectionTable/index.jsx | 4 +- src/components/Cars/List/index.jsx | 4 +- src/components/Cars/Status/index.jsx | 4 +- .../Contexts/__mocks__/VehicleContext.jsx | 3 + src/components/Table/HeaderSortable/index.jsx | 2 +- .../Create/__snapshots__/Create.test.js.snap | 16 +- src/components/UpdatePackages/List/index.jsx | 4 +- src/components/VehicleMap/index.jsx | 178 +++-- src/components/VehicleMap/popup.jsx | 82 +- src/components/useStyles.jsx | 22 + src/services/__mocks__/vehicles.js | 7 +- 16 files changed, 747 insertions(+), 332 deletions(-) create mode 100644 src/assets/green-car.png create mode 100644 src/assets/red-car.png diff --git a/src/assets/green-car.png b/src/assets/green-car.png new file mode 100644 index 0000000000000000000000000000000000000000..f25b6200c0b5b005e09fe275706b695e35f2c8c1 GIT binary patch literal 676 zcmV;V0$crwP)@1Q43YtXi-POS)@%1Qn%9D^b-0$4qnnrbBRf56(s-Vp1bFH z|G&F?-uHo~{&z{OWF*ynK{3}s4gsM$Jsr?5qTJ5*W}Y?-j-+A(irlFa<|`HHpFKA| zTsL^eX70)b#i~@*hxwJO# z(__8tUZasz{07P{wRA5k5uih%U7!`%<}R35Cy zlzJ@CsjKl#$8H@8I)wq0Qn97dIo&({(a$xKj&-S#Nosfq(pB;*1_~X;IOpi_-088O zIn9@iI}I4$a}S^^fwKML=iz1ePA=P){_Rg?y0000< KMNUMnLSTZBL^~J& literal 0 HcmV?d00001 diff --git a/src/assets/red-car.png b/src/assets/red-car.png new file mode 100644 index 0000000000000000000000000000000000000000..af6edbc58d5ab1e8668a79351f8120132c3460ba GIT binary patch literal 648 zcmV;30(bq1P)s$B32OGYHPk;-a8Jy+Lz>|zJx?U@`nrO-gD3Y zcQ5w?hWg(nyCrMs*-IjN6Bq~LAw6qANzr?8tN6TYa6O&9fv^}7*2z9+TKT2WU>!fd z&yL1E0!f7H#&>-zYsFd^lpdLh+hcMKcmR|Qr*TM1E8kk@MS_a$NNf%m708?K3y;D= z0c5RMGp)iyfn{LS^J-Hd7~v{_tMVi)uvM<`)CRP)zW_E6 zPE^wuj{XrGb!83^MDz0QS*2I7tgco;ivUq^FSq7ntpkc&0R<#ur?aImr zpe7Obbo1PH4^d9Fff2^G!lZ_>I5 i^Zf%4#&@WpI_f9 { expect(container).toMatchSnapshot(); }; +const sleepAndCheck = async (path, selector, compare) => { + const container = await renderRoute(path); + await waitFor(() => { }); + expect(container.querySelector(selector).innerHTML).toEqual(compare); + expect(container).toMatchSnapshot(); +}; + describe("App", () => { beforeAll(() => { // Stablize Table Pagination control ids @@ -93,12 +100,12 @@ describe("App", () => { it("Route / authenticated", async () => { setToken(TEST_AUTH_OBJECT); - await check("/", "h1", "Welcome John!"); + await sleepAndCheck("/", "h1", "Welcome John!"); }); it("Route /home authenticated", async () => { setToken(TEST_AUTH_OBJECT); - await check("/home", "h1", "Welcome John!"); + await sleepAndCheck("/home", "h1", "Welcome John!"); }); it("Route /package-upload authenticated", async () => { diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index f51c82a..4aa434c 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,22 +212,152 @@ exports[`App Route / authenticated 1`] = `

Welcome John!

+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+ + Leaflet + + | © + + OpenStreetMap + + contributors +
+
+
+
+
@@ -297,10 +427,10 @@ exports[`App Route /carupdate-deploy authenticated 1`] = ` data-testid="mocked-userprovider" >
Fisker Admin Portal
@@ -505,10 +635,10 @@ exports[`App Route /carupdate-deploy authenticated 1`] = `

0 Selected
@@ -602,7 +732,7 @@ exports[`App Route /carupdate-deploy authenticated 1`] = ` style="text-align: right;" >
VIN sorted ascending @@ -955,10 +1085,10 @@ exports[`App Route /carupdate-deploy unauthenticated 1`] = ` data-testid="mocked-userprovider" >
@@ -1473,10 +1603,10 @@ exports[`App Route /dashboard authenticated 1`] = ` data-testid="mocked-userprovider" >
Fisker Admin Portal
@@ -1681,25 +1811,25 @@ exports[`App Route /dashboard authenticated 1`] = `