CEC-1230 Datascope opens iframe dashboard (#174)

* CEC-1230 Datascope opens iframe dashboard

* Clean up
This commit is contained in:
John Wu
2022-08-04 11:59:02 -07:00
committed by GitHub
parent 00af90902e
commit 93926d3c01
82 changed files with 1219 additions and 1008 deletions

View File

@@ -2,4 +2,4 @@ REACT_APP_CERT_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/certificate
REACT_APP_AUTH_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/compute_auth REACT_APP_AUTH_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/compute_auth
REACT_APP_UPLOAD_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/ota_update REACT_APP_UPLOAD_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/ota_update
REACT_APP_AUTH_CALLBACK_URL=https://dev-ota-admin.cloud.fiskerinc.com REACT_APP_AUTH_CALLBACK_URL=https://dev-ota-admin.cloud.fiskerinc.com
REACT_APP_SUPERSET_URL=https://dev-superset.cloud.fiskerinc.com REACT_APP_SUPERSET_URL=http://superset-dev.fiskercloud.internal/superset/dashboard/8/?native_filters_key=KPnPthpLQ8rT--6PUdsPzQAcwnleRGHk_3dg0PVYfrXc3SE6zZ2x0p7JuerAZ0Pg

View File

@@ -2,4 +2,4 @@ REACT_APP_AUTH_SERVICE_URL=http://localhost/compute_auth
REACT_APP_CERT_SERVICE_URL=http://localhost/certificate REACT_APP_CERT_SERVICE_URL=http://localhost/certificate
REACT_APP_UPLOAD_SERVICE_URL=http://localhost/ota_update REACT_APP_UPLOAD_SERVICE_URL=http://localhost/ota_update
REACT_APP_AUTH_CALLBACK_URL=http://localhost:3000 REACT_APP_AUTH_CALLBACK_URL=http://localhost:3000
REACT_APP_SUPERSET_URL=https://dev-superset.cloud.fiskerinc.com REACT_APP_SUPERSET_URL=http://superset-dev.fiskercloud.internal/superset/dashboard/8/?native_filters_key=KPnPthpLQ8rT--6PUdsPzQAcwnleRGHk_3dg0PVYfrXc3SE6zZ2x0p7JuerAZ0Pg

View File

@@ -2,4 +2,4 @@ REACT_APP_AUTH_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/compute_auth
REACT_APP_CERT_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/certificate REACT_APP_CERT_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/certificate
REACT_APP_UPLOAD_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/ota_update REACT_APP_UPLOAD_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/ota_update
REACT_APP_AUTH_CALLBACK_URL=https://stg-ota-admin.cloud.fiskerinc.com REACT_APP_AUTH_CALLBACK_URL=https://stg-ota-admin.cloud.fiskerinc.com
REACT_APP_SUPERSET_URL=https://stg-superset.cloud.fiskerinc.com REACT_APP_SUPERSET_URL=http://superset-dev.fiskercloud.internal/superset/dashboard/8/?native_filters_key=KPnPthpLQ8rT--6PUdsPzQAcwnleRGHk_3dg0PVYfrXc3SE6zZ2x0p7JuerAZ0Pg

View File

@@ -17,6 +17,7 @@ import {
import { setToken } from "../Contexts/UserContext"; import { setToken } from "../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../utils/testing";
import App from "."; import App from ".";
import addSnapshotSerializer from "../../utils/snapshot";
const LOADING_STATUS = "Loading..."; const LOADING_STATUS = "Loading...";
@@ -43,32 +44,8 @@ const sleepAndCheck = async (path, selector, compare) => {
}; };
describe("App", () => { describe("App", () => {
const rxMakeStyles = /makeStyles-(\w+)-(\d+)/gi;
beforeAll(() => { beforeAll(() => {
// Stablize Table Pagination control ids addSnapshotSerializer(expect);
expect.addSnapshotSerializer({
test: function (val) {
return val && typeof val === "string" && val.indexOf("mui-") > -1;
},
print: function (val) {
let str = val;
str = str.replace(/mui-\d*/g, "mui-00000");
return `"${str}"`;
},
});
expect.addSnapshotSerializer({
test: (val) => {
return val && typeof val === "string" && val.search(rxMakeStyles) > -1;
},
print: function (val) {
let str = val;
str = str.replace(rxMakeStyles, "makeStyles-$1-0000");
return `"${str}"`;
},
});
}, 60000); }, 60000);
afterEach(() => { afterEach(() => {
@@ -134,7 +111,7 @@ describe("App", () => {
it("Route /tools/sms/send unauthenticated", async () => { it("Route /tools/sms/send unauthenticated", async () => {
await check("/tools/sms/send", "span.MuiButton-label", "Sign In"); await check("/tools/sms/send", "span.MuiButton-label", "Sign In");
}) });
it("Route /page-not-found unauthenticated", async () => { it("Route /page-not-found unauthenticated", async () => {
await check("/page-not-found", "h1", "Page Not Found"); await check("/page-not-found", "h1", "Page Not Found");

File diff suppressed because it is too large Load Diff

View File

@@ -15,11 +15,11 @@ exports[`CANFiltersAdd Render 1`] = `
data-testid="mocked-canfiltersprovider" data-testid="mocked-canfiltersprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -56,10 +56,10 @@ exports[`CANFiltersAdd Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
VIN VIN
@@ -102,10 +102,10 @@ exports[`CANFiltersAdd Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
CAN ID CAN ID
@@ -140,10 +140,10 @@ exports[`CANFiltersAdd Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
Interval Interval
@@ -153,7 +153,7 @@ exports[`CANFiltersAdd Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { CANFiltersProvider } from "../../Contexts/CANFiltersContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCANFiltersAdd = async () => { const renderCANFiltersAdd = async () => {
const { container } = render( const { container } = render(
@@ -20,14 +21,19 @@ const renderCANFiltersAdd = async () => {
<MainForm /> <MainForm />
</BrowserRouter> </BrowserRouter>
</UserProvider> </UserProvider>
</StatusProvider>f </StatusProvider>
f
</CANFiltersProvider> </CANFiltersProvider>
); );
await waitFor(() => { }); await waitFor(() => {});
return container; return container;
}; };
describe("CANFiltersAdd", () => { describe("CANFiltersAdd", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderCANFiltersAdd(); const container = await renderCANFiltersAdd();

View File

@@ -15,16 +15,16 @@ exports[`CANFiltersTable Render 1`] = `
data-testid="mocked-canfiltersprovider" data-testid="mocked-canfiltersprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textJustifyAlign-47 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<a <a
class="makeStyles-labelInline-9" class="makeStyles-labelInline-0"
href="/filter-add?vin=undefined" href="/filter-add?vin=undefined"
> >
<svg <svg
@@ -40,10 +40,10 @@ exports[`CANFiltersTable Render 1`] = `
</a> </a>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-8" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-8"
> >
<div <div
class="MuiFormControl-root makeStyles-margin-28 makeStyles-fullWidth-50" class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"
> >
<label <label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated"

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/CANFiltersContext"); jest.mock("../../Contexts/CANFiltersContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,7 +12,8 @@ import { CANFiltersProvider } from "../../Contexts/CANFiltersContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCANFiltersTable = async () => { const renderCANFiltersTable = async () => {
const { container } = render( const { container } = render(
@@ -26,11 +27,15 @@ const renderCANFiltersTable = async () => {
</StatusProvider> </StatusProvider>
</CANFiltersProvider> </CANFiltersProvider>
); );
await waitFor(() => { }); await waitFor(() => {});
return container; return container;
}; };
describe("CANFiltersTable", () => { describe("CANFiltersTable", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderCANFiltersTable(); const container = await renderCANFiltersTable();

View File

@@ -15,11 +15,11 @@ exports[`CANFiltersUpdate Render 1`] = `
data-testid="mocked-canfiltersprovider" data-testid="mocked-canfiltersprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -56,10 +56,10 @@ exports[`CANFiltersUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
VIN VIN
@@ -103,10 +103,10 @@ exports[`CANFiltersUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
CAN ID CAN ID
@@ -149,10 +149,10 @@ exports[`CANFiltersUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
Interval Interval
@@ -163,7 +163,7 @@ exports[`CANFiltersUpdate Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { CANFiltersProvider } from "../../Contexts/CANFiltersContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCANFiltersUpdate = async () => { const renderCANFiltersUpdate = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,15 @@ const renderCANFiltersUpdate = async () => {
</StatusProvider> </StatusProvider>
</CANFiltersProvider> </CANFiltersProvider>
); );
await waitFor(() => { }); await waitFor(() => {});
return container; return container;
}; };
describe("CANFiltersUpdate", () => { describe("CANFiltersUpdate", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderCANFiltersUpdate(); const container = await renderCANFiltersUpdate();

View File

@@ -15,11 +15,11 @@ exports[`VehicleAddForm Render 1`] = `
data-testid="mocked-vehicleprovider" data-testid="mocked-vehicleprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -55,10 +55,10 @@ exports[`VehicleAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
VIN VIN
@@ -101,10 +101,10 @@ exports[`VehicleAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Model Model
@@ -148,10 +148,10 @@ exports[`VehicleAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Year Year
@@ -195,10 +195,10 @@ exports[`VehicleAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Trim Trim
@@ -225,19 +225,19 @@ exports[`VehicleAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="trace" value="trace"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -251,7 +251,7 @@ exports[`VehicleAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -276,19 +276,19 @@ exports[`VehicleAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="debug" value="debug"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -302,7 +302,7 @@ exports[`VehicleAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -327,20 +327,20 @@ exports[`VehicleAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
checked="" checked=""
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="info" value="info"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70 PrivateRadioButtonIcon-checked-72" class="PrivateRadioButtonIcon-root-71 PrivateRadioButtonIcon-checked-73"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -354,7 +354,7 @@ exports[`VehicleAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -379,19 +379,19 @@ exports[`VehicleAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="warn" value="warn"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -405,7 +405,7 @@ exports[`VehicleAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -430,19 +430,19 @@ exports[`VehicleAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="error" value="error"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -456,7 +456,7 @@ exports[`VehicleAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -481,19 +481,19 @@ exports[`VehicleAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="critical" value="critical"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -507,7 +507,7 @@ exports[`VehicleAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -542,14 +542,14 @@ exports[`VehicleAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
checked="" checked=""
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
data-indeterminate="false" data-indeterminate="false"
type="checkbox" type="checkbox"
value="" value=""
@@ -608,10 +608,10 @@ exports[`VehicleAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Max Memory Buffer Size (0 uses default size) Max Memory Buffer Size (0 uses default size)
@@ -626,13 +626,13 @@ exports[`VehicleAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiCheckbox-root MuiCheckbox-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiCheckbox-root MuiCheckbox-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
data-indeterminate="false" data-indeterminate="false"
type="checkbox" type="checkbox"
value="" value=""
@@ -693,10 +693,10 @@ exports[`VehicleAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Max Disk Buffer Size (0 uses default size) Max Disk Buffer Size (0 uses default size)
@@ -707,7 +707,7 @@ exports[`VehicleAddForm Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { VehicleProvider } from "../../Contexts/VehicleContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderVehicleAdd = async () => { const renderVehicleAdd = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,17 @@ const renderVehicleAdd = async () => {
</StatusProvider> </StatusProvider>
</VehicleProvider> </VehicleProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("VehicleAddForm", () => { describe("VehicleAddForm", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderVehicleAdd(); const container = await renderVehicleAdd();

View File

@@ -15,13 +15,13 @@ exports[`VehicleTable Render 1`] = `
data-testid="mocked-vehicleprovider" data-testid="mocked-vehicleprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textJustifyAlign-47 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<a <a
href="/vehicle-add" href="/vehicle-add"
@@ -39,10 +39,10 @@ exports[`VehicleTable Render 1`] = `
</a> </a>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<div <div
class="MuiFormControl-root makeStyles-margin-28 makeStyles-fullWidth-50" class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"
> >
<label <label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated"
@@ -93,11 +93,11 @@ exports[`VehicleTable Render 1`] = `
</div> </div>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textRightAlign-49 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textRightAlign-0 MuiGrid-item MuiGrid-grid-md-4"
/> />
</div> </div>
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<table <table
class="MuiTable-root" class="MuiTable-root"
@@ -121,7 +121,7 @@ exports[`VehicleTable Render 1`] = `
> >
VIN VIN
<span <span
class="makeStyles-hiddenSortSpan-27" class="makeStyles-hiddenSortSpan-0"
> >
sorted ascending sorted ascending
</span> </span>

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/VehicleContext"); jest.mock("../../Contexts/VehicleContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,7 +12,8 @@ import { VehicleProvider } from "../../Contexts/VehicleContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderVehicleTable = async () => { const renderVehicleTable = async () => {
const { container } = render( const { container } = render(
@@ -26,11 +27,17 @@ const renderVehicleTable = async () => {
</StatusProvider> </StatusProvider>
</VehicleProvider> </VehicleProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("VehicleTable", () => { describe("VehicleTable", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderVehicleTable(); const container = await renderVehicleTable();

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/CANFiltersContext"); jest.mock("../../Contexts/CANFiltersContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -10,7 +10,8 @@ import { BrowserRouter } from "react-router-dom";
import { setToken } from "../../Contexts/UserContext"; import { setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import CANFiltersTab from "./CANFiltersTab" import CANFiltersTab from "./CANFiltersTab";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCANFiltersTab = async () => { const renderCANFiltersTab = async () => {
const { container } = render( const { container } = render(
@@ -18,11 +19,17 @@ const renderCANFiltersTab = async () => {
<CANFiltersTab vin="TESTVIN1234567890" /> <CANFiltersTab vin="TESTVIN1234567890" />
</BrowserRouter> </BrowserRouter>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("CANFiltersTab", () => { describe("CANFiltersTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderCANFiltersTab(); const container = await renderCANFiltersTab();

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/CANFiltersContext"); jest.mock("../../Contexts/CANFiltersContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,7 +12,8 @@ import { CANFiltersProvider } from "../../Contexts/CANFiltersContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./CarUpdatesTab" import MainForm from "./CarUpdatesTab";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCarUpdatesTab = async () => { const renderCarUpdatesTab = async () => {
const { container } = render( const { container } = render(
@@ -26,11 +27,17 @@ const renderCarUpdatesTab = async () => {
</StatusProvider> </StatusProvider>
</CANFiltersProvider> </CANFiltersProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("CarUpdatesTab", () => { describe("CarUpdatesTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderCarUpdatesTab(); const container = await renderCarUpdatesTab();

View File

@@ -15,13 +15,13 @@ exports[`VehicleDetailsTab Render 1`] = `
data-testid="mocked-vehicleprovider" data-testid="mocked-vehicleprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<p> <p>
<b> <b>
@@ -38,7 +38,7 @@ exports[`VehicleDetailsTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<b> <b>
CANBus CANBus
@@ -80,7 +80,7 @@ exports[`VehicleDetailsTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<a <a
class="" class=""

View File

@@ -9,7 +9,8 @@ import { VehicleProvider } from "../../../Contexts/VehicleContext";
import { StatusProvider } from "../../../Contexts/StatusContext"; import { StatusProvider } from "../../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../../Contexts/UserContext"; import { UserProvider, setToken } from "../../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../../utils/snapshot";
const renderVehicleDetailsTab = async () => { const renderVehicleDetailsTab = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,17 @@ const renderVehicleDetailsTab = async () => {
</StatusProvider> </StatusProvider>
</VehicleProvider> </VehicleProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("VehicleDetailsTab", () => { describe("VehicleDetailsTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderVehicleDetailsTab(); const container = await renderVehicleDetailsTab();

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/VehicleContext"); jest.mock("../../Contexts/VehicleContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,27 +12,34 @@ import { VehicleProvider } from "../../Contexts/VehicleContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./DetailsTab" import MainForm from "./DetailsTab";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderDetailsTab = async () => { const renderDetailsTab = async () => {
const { container } = render( const { container } = render(
<VehicleProvider> <VehicleProvider>
<StatusProvider> <StatusProvider>
<UserProvider> <UserProvider>
<MemoryRouter initialEntries={['/testroute/TESTVIN1234567890']}> <MemoryRouter initialEntries={["/testroute/TESTVIN1234567890"]}>
<Route path="/testroute/:vin"> <Route path="/testroute/:vin">
<MainForm vin="TESTVIN1234567890" /> <MainForm vin="TESTVIN1234567890" />
</Route> </Route>
</MemoryRouter> </MemoryRouter>
</UserProvider> </UserProvider>
</StatusProvider> </StatusProvider>
</VehicleProvider > </VehicleProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("DetailsTab", () => { describe("DetailsTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderDetailsTab(); const container = await renderDetailsTab();

View File

@@ -12,6 +12,7 @@ import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import DigitalTwinTab from "./DigitalTwinTab"; import DigitalTwinTab from "./DigitalTwinTab";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderDetailsTab = async () => { const renderDetailsTab = async () => {
const { container } = render( const { container } = render(
@@ -28,6 +29,10 @@ const renderDetailsTab = async () => {
}; };
describe("DigitalTwinTab", () => { describe("DigitalTwinTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderDetailsTab(); const container = await renderDetailsTab();

View File

@@ -3,7 +3,7 @@
exports[`CANFiltersTab Render 1`] = ` exports[`CANFiltersTab Render 1`] = `
<div> <div>
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -14,16 +14,16 @@ exports[`CANFiltersTab Render 1`] = `
data-testid="mocked-canfiltersprovider" data-testid="mocked-canfiltersprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textJustifyAlign-47 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<a <a
class="makeStyles-labelInline-9" class="makeStyles-labelInline-0"
href="/filter-add?vin=undefined" href="/filter-add?vin=undefined"
> >
<svg <svg
@@ -39,10 +39,10 @@ exports[`CANFiltersTab Render 1`] = `
</a> </a>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-8" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-8"
> >
<div <div
class="MuiFormControl-root makeStyles-margin-28 makeStyles-fullWidth-50" class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"
> >
<label <label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated"

View File

@@ -12,7 +12,7 @@ exports[`CarUpdatesTab Render 1`] = `
data-testid="mocked-userprovider" data-testid="mocked-userprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -41,7 +41,7 @@ exports[`CarUpdatesTab Render 1`] = `
> >
ID ID
<span <span
class="makeStyles-hiddenSortSpan-27" class="makeStyles-hiddenSortSpan-0"
> >
sorted descending sorted descending
</span> </span>
@@ -279,12 +279,12 @@ exports[`CarUpdatesTab Render 1`] = `
</tfoot> </tfoot>
</table> </table>
<h6 <h6
class="MuiTypography-root makeStyles-labelInline-9 MuiTypography-h6" class="MuiTypography-root makeStyles-labelInline-0 MuiTypography-h6"
> >
Car ECUs Car ECUs
</h6> </h6>
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<table <table
class="MuiTable-root" class="MuiTable-root"
@@ -308,7 +308,7 @@ exports[`CarUpdatesTab Render 1`] = `
> >
ECU ECU
<span <span
class="makeStyles-hiddenSortSpan-27" class="makeStyles-hiddenSortSpan-0"
> >
sorted descending sorted descending
</span> </span>

View File

@@ -12,7 +12,7 @@ exports[`DetailsTab Render 1`] = `
data-testid="mocked-userprovider" data-testid="mocked-userprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -23,13 +23,13 @@ exports[`DetailsTab Render 1`] = `
data-testid="mocked-vehicleprovider" data-testid="mocked-vehicleprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<p> <p>
<b> <b>
@@ -47,7 +47,7 @@ exports[`DetailsTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<b> <b>
CANBus CANBus
@@ -89,7 +89,7 @@ exports[`DetailsTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<a <a
class="" class=""

View File

@@ -12,7 +12,7 @@ exports[`DigitalTwinTab Render 1`] = `
data-testid="mocked-vehicleprovider" data-testid="mocked-vehicleprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -36,7 +36,7 @@ exports[`DigitalTwinTab Render 1`] = `
95% 95%
</p> </p>
<div <div
class="makeStyles-popupSection-40" class="makeStyles-popupSection-0"
> >
<h3> <h3>
Doors Doors
@@ -85,7 +85,7 @@ exports[`DigitalTwinTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="makeStyles-popupSection-40" class="makeStyles-popupSection-0"
> >
<h3> <h3>
Location Location
@@ -113,7 +113,7 @@ exports[`DigitalTwinTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="makeStyles-popupSection-40" class="makeStyles-popupSection-0"
> >
<p> <p>
<b> <b>
@@ -124,7 +124,7 @@ exports[`DigitalTwinTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="makeStyles-popupSection-40" class="makeStyles-popupSection-0"
> >
<p> <p>
<b> <b>

View File

@@ -12,10 +12,10 @@ exports[`CarStatus Render 1`] = `
data-testid="mocked-userprovider" data-testid="mocked-userprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiBox-root MuiBox-root-62 makeStyles-tableToolbar-30" class="MuiBox-root MuiBox-root-63 makeStyles-tableToolbar-0"
> >
<div <div
class="MuiTabs-root" class="MuiTabs-root"
@@ -103,7 +103,7 @@ exports[`CarStatus Render 1`] = `
</button> </button>
</div> </div>
<span <span
class="PrivateTabIndicator-root-63 PrivateTabIndicator-colorSecondary-65 MuiTabs-indicator" class="PrivateTabIndicator-root-64 PrivateTabIndicator-colorSecondary-66 MuiTabs-indicator"
style="left: 0px; width: 0px;" style="left: 0px; width: 0px;"
/> />
</div> </div>
@@ -115,10 +115,10 @@ exports[`CarStatus Render 1`] = `
role="tabpanel" role="tabpanel"
> >
<div <div
class="MuiBox-root MuiBox-root-67" class="MuiBox-root MuiBox-root-68"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -126,13 +126,13 @@ exports[`CarStatus Render 1`] = `
Vehicle Details Vehicle Details
</h6> </h6>
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<p> <p>
<b> <b>
@@ -142,7 +142,7 @@ exports[`CarStatus Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<a <a
class="" class=""

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/CANFiltersContext"); jest.mock("../../Contexts/CANFiltersContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,7 +12,8 @@ import { CANFiltersProvider } from "../../Contexts/CANFiltersContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import CarStatus from "./index" import CarStatus from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCarStatus = async () => { const renderCarStatus = async () => {
const { container } = render( const { container } = render(
@@ -26,11 +27,17 @@ const renderCarStatus = async () => {
</StatusProvider> </StatusProvider>
</CANFiltersProvider> </CANFiltersProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("CarStatus", () => { describe("CarStatus", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderCarStatus(); const container = await renderCarStatus();

View File

@@ -15,11 +15,11 @@ exports[`VehicleUpdate Render 1`] = `
data-testid="mocked-vehicleprovider" data-testid="mocked-vehicleprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -57,10 +57,10 @@ exports[`VehicleUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
VIN VIN
@@ -103,10 +103,10 @@ exports[`VehicleUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Model Model
@@ -150,10 +150,10 @@ exports[`VehicleUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Year Year
@@ -197,10 +197,10 @@ exports[`VehicleUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Trim Trim
@@ -227,19 +227,19 @@ exports[`VehicleUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="trace" value="trace"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -253,7 +253,7 @@ exports[`VehicleUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -278,19 +278,19 @@ exports[`VehicleUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="debug" value="debug"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -304,7 +304,7 @@ exports[`VehicleUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -329,20 +329,20 @@ exports[`VehicleUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
checked="" checked=""
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="info" value="info"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70 PrivateRadioButtonIcon-checked-72" class="PrivateRadioButtonIcon-root-71 PrivateRadioButtonIcon-checked-73"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -356,7 +356,7 @@ exports[`VehicleUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -381,19 +381,19 @@ exports[`VehicleUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="warn" value="warn"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -407,7 +407,7 @@ exports[`VehicleUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -432,19 +432,19 @@ exports[`VehicleUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="error" value="error"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -458,7 +458,7 @@ exports[`VehicleUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -483,19 +483,19 @@ exports[`VehicleUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="critical" value="critical"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -509,7 +509,7 @@ exports[`VehicleUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -544,14 +544,14 @@ exports[`VehicleUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
checked="" checked=""
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
data-indeterminate="false" data-indeterminate="false"
type="checkbox" type="checkbox"
value="" value=""
@@ -610,10 +610,10 @@ exports[`VehicleUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Max Memory Buffer Size (0 uses default size) Max Memory Buffer Size (0 uses default size)
@@ -628,13 +628,13 @@ exports[`VehicleUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
data-indeterminate="false" data-indeterminate="false"
type="checkbox" type="checkbox"
value="" value=""
@@ -694,10 +694,10 @@ exports[`VehicleUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Max Disk Buffer Size (0 uses default size) Max Disk Buffer Size (0 uses default size)
@@ -708,7 +708,7 @@ exports[`VehicleUpdate Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { VehicleProvider } from "../../Contexts/VehicleContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderVehicleUpdate = async () => { const renderVehicleUpdate = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,17 @@ const renderVehicleUpdate = async () => {
</StatusProvider> </StatusProvider>
</VehicleProvider> </VehicleProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("VehicleUpdate", () => { describe("VehicleUpdate", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderVehicleUpdate(); const container = await renderVehicleUpdate();

View File

@@ -2,11 +2,13 @@ import React from "react";
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
import DownloadCerts from "./DownloadCerts"; import DownloadCerts from "./DownloadCerts";
import addSnapshotSerializer from "../../../utils/snapshot";
describe("DownloadCerts", () => { describe("DownloadCerts", () => {
beforeAll(() => { beforeAll(() => {
global.URL.createObjectURL = jest.fn(); global.URL.createObjectURL = jest.fn();
global.URL.revokeObjectURL = jest.fn(); global.URL.revokeObjectURL = jest.fn();
addSnapshotSerializer(expect);
}); });
it("Render", async () => { it("Render", async () => {

View File

@@ -23,7 +23,7 @@ exports[`DownloadCerts Render 1`] = `
</li> </li>
</ul> </ul>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -4,6 +4,7 @@ import { render, waitFor } from "@testing-library/react";
import CarUpdateStatusProgress from "../CarUpdateStatusProgress"; import CarUpdateStatusProgress from "../CarUpdateStatusProgress";
import useStyles from "../../useStyles"; import useStyles from "../../useStyles";
import s from "./Statuses"; import s from "./Statuses";
import addSnapshotSerializer from "../../../utils/snapshot";
const TestWrapper = ({ status }) => { const TestWrapper = ({ status }) => {
const classes = useStyles(); const classes = useStyles();
@@ -17,6 +18,10 @@ const renderCarUpdateStatusProgress = async (status) => {
}; };
describe("CarUpdateStatusProgress", () => { describe("CarUpdateStatusProgress", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
const tests = [ const tests = [
{ {
name: "manifest_received", name: "manifest_received",

View File

@@ -7,6 +7,7 @@ import { CarUpdatesProvider } from "../../Contexts/CarUpdatesContext";
import CarUpdateStatusTable from "../CarUpdateStatusTable"; import CarUpdateStatusTable from "../CarUpdateStatusTable";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCarUpdateStatusTable = async () => { const renderCarUpdateStatusTable = async () => {
const { container } = render( const { container } = render(
@@ -22,17 +23,7 @@ const renderCarUpdateStatusTable = async () => {
describe("CarUpdateStatusTable", () => { describe("CarUpdateStatusTable", () => {
beforeAll(() => { beforeAll(() => {
expect.addSnapshotSerializer({ addSnapshotSerializer(expect);
test: function (val) {
return val && typeof val === "string" && val.indexOf("mui-") >= 0;
},
print: function (val) {
let str = val;
str = str.replace(/mui-\d*/g, "mui-00000");
return `"${str}"`;
},
});
}); });
it("Render", async () => { it("Render", async () => {

View File

@@ -194,7 +194,7 @@ exports[`CarUpdateStatusTable Render 1`] = `
/> />
<p <p
class="MuiTypography-root MuiTablePagination-caption MuiTypography-body2 MuiTypography-colorInherit" class="MuiTypography-root MuiTablePagination-caption MuiTypography-body2 MuiTypography-colorInherit"
id="mui-00000" id="mui-0"
> >
Rows per page: Rows per page:
</p> </p>
@@ -204,7 +204,7 @@ exports[`CarUpdateStatusTable Render 1`] = `
<select <select
aria-label="rows per page" aria-label="rows per page"
class="MuiSelect-root MuiSelect-select MuiTablePagination-select MuiInputBase-input" class="MuiSelect-root MuiSelect-select MuiTablePagination-select MuiInputBase-input"
id="mui-00000" id="mui-0"
> >
<option <option
class="MuiTablePagination-menuItem" class="MuiTablePagination-menuItem"

View File

@@ -2,11 +2,13 @@ import React from "react";
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
import DownloadFileLink from "."; import DownloadFileLink from ".";
import addSnapshotSerializer from "../../../utils/snapshot";
describe("DownloadFileLink", () => { describe("DownloadFileLink", () => {
beforeAll(() => { beforeAll(() => {
global.URL.createObjectURL = jest.fn(); global.URL.createObjectURL = jest.fn();
global.URL.revokeObjectURL = jest.fn(); global.URL.revokeObjectURL = jest.fn();
addSnapshotSerializer(expect);
}); });
it("Render", async () => { it("Render", async () => {

View File

@@ -1,20 +1,15 @@
import React from "react"; import React from "react";
const ResponsiveIFrame = (props) => { const ResponsiveIFrame = (props) => {
const { classes, src, title } = props; const { classes, src, title, fullscreen } = props;
const container = fullscreen
? classes.iframeResponsive
: classes.embeddedWrapper;
return ( return (
<div className={classes.embeddedWrapper}> <div className={container}>
<iframe <iframe
style={{ className={classes.iframeResponsive}
position: "absolute",
top: 0,
left: 0,
bottom: 0,
right: 0,
width: "100%",
height: "100%",
}}
title={title} title={title}
src={src} src={src}
frameBorder="0" frameBorder="0"

View File

@@ -1,7 +1,7 @@
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
import TabPanel from "./index" import TabPanel from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderTabPanel = async () => { const renderTabPanel = async () => {
const { container } = render( const { container } = render(
@@ -9,11 +9,15 @@ const renderTabPanel = async () => {
<div>Test</div> <div>Test</div>
</TabPanel> </TabPanel>
); );
await waitFor(() => { }); await waitFor(() => {});
return container; return container;
}; };
describe("TabPanel", () => { describe("TabPanel", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
const container = await renderTabPanel(); const container = await renderTabPanel();
expect(container).toMatchSnapshot(); expect(container).toMatchSnapshot();

View File

@@ -0,0 +1,26 @@
import React, { useEffect } from "react";
import ResponsiveIFrame from "../Controls/ResponsiveIFrame";
import { SupersetDashboardURL } from "../../services/superset";
import { useStatusContext } from "../Contexts/StatusContext";
import useStyles from "../useStyles";
const Dashboard = () => {
const classes = useStyles();
const { setTitle } = useStatusContext();
useEffect(() => {
setTitle("Datascope");
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<ResponsiveIFrame
src={SupersetDashboardURL}
title="Dashboard"
classes={classes}
fullscreen
/>
);
};
export default Dashboard;

View File

@@ -15,11 +15,11 @@ exports[`FleetAddForm Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -55,10 +55,10 @@ exports[`FleetAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
Name Name
@@ -85,19 +85,19 @@ exports[`FleetAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="trace" value="trace"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -111,7 +111,7 @@ exports[`FleetAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -136,19 +136,19 @@ exports[`FleetAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="debug" value="debug"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -162,7 +162,7 @@ exports[`FleetAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -187,20 +187,20 @@ exports[`FleetAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
checked="" checked=""
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="info" value="info"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70 PrivateRadioButtonIcon-checked-72" class="PrivateRadioButtonIcon-root-71 PrivateRadioButtonIcon-checked-73"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -214,7 +214,7 @@ exports[`FleetAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -239,19 +239,19 @@ exports[`FleetAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="warn" value="warn"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -265,7 +265,7 @@ exports[`FleetAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -290,19 +290,19 @@ exports[`FleetAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="error" value="error"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -316,7 +316,7 @@ exports[`FleetAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -341,19 +341,19 @@ exports[`FleetAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="critical" value="critical"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -367,7 +367,7 @@ exports[`FleetAddForm Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -402,14 +402,14 @@ exports[`FleetAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
checked="" checked=""
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
data-indeterminate="false" data-indeterminate="false"
type="checkbox" type="checkbox"
value="" value=""
@@ -468,10 +468,10 @@ exports[`FleetAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Max Memory Buffer Size (0 uses default size) Max Memory Buffer Size (0 uses default size)
@@ -486,13 +486,13 @@ exports[`FleetAddForm Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiCheckbox-root MuiCheckbox-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiCheckbox-root MuiCheckbox-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
data-indeterminate="false" data-indeterminate="false"
type="checkbox" type="checkbox"
value="" value=""
@@ -553,10 +553,10 @@ exports[`FleetAddForm Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Max Disk Buffer Size (0 uses default size) Max Disk Buffer Size (0 uses default size)
@@ -567,7 +567,7 @@ exports[`FleetAddForm Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { FleetProvider } from "../../Contexts/FleetContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderFleetAdd = async () => { const renderFleetAdd = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,17 @@ const renderFleetAdd = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("FleetAddForm", () => { describe("FleetAddForm", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetAdd(); const container = await renderFleetAdd();

View File

@@ -15,11 +15,11 @@ exports[`FleetCANFilterAdd Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -56,10 +56,10 @@ exports[`FleetCANFilterAdd Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
Fleet Name Fleet Name
@@ -102,10 +102,10 @@ exports[`FleetCANFilterAdd Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
CAN ID CAN ID
@@ -140,10 +140,10 @@ exports[`FleetCANFilterAdd Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
Interval Interval
@@ -153,7 +153,7 @@ exports[`FleetCANFilterAdd Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { FleetProvider } from "../../../../Contexts/FleetContext";
import { StatusProvider } from "../../../../Contexts/StatusContext"; import { StatusProvider } from "../../../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../../../Contexts/UserContext"; import { UserProvider, setToken } from "../../../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../../../utils/snapshot";
const renderFleetCANFilterAdd = async () => { const renderFleetCANFilterAdd = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,15 @@ const renderFleetCANFilterAdd = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { }); await waitFor(() => {});
return container; return container;
}; };
describe("FleetCANFilterAdd", () => { describe("FleetCANFilterAdd", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetCANFilterAdd(); const container = await renderFleetCANFilterAdd();

View File

@@ -15,16 +15,16 @@ exports[`FleetCANFiltersTable Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textJustifyAlign-47 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<a <a
class="makeStyles-labelInline-9" class="makeStyles-labelInline-0"
href="/fleet/undefined/filter-add" href="/fleet/undefined/filter-add"
> >
<svg <svg
@@ -41,10 +41,10 @@ exports[`FleetCANFiltersTable Render 1`] = `
</div> </div>
<div <div
align="right" align="right"
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-8" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-8"
> >
<div <div
class="MuiFormControl-root makeStyles-margin-28 makeStyles-fullWidth-50" class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"
> >
<label <label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated"

View File

@@ -1,8 +1,8 @@
jest.mock("../../../../Contexts/FleetContext"); jest.mock("../../../../Contexts/FleetContext");
jest.mock("../../../../Contexts/StatusContext"); jest.mock("../../../../Contexts/StatusContext");
jest.mock("../../../../Contexts/UserContext"); jest.mock("../../../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,7 +12,8 @@ import { FleetProvider } from "../../../../Contexts/FleetContext";
import { StatusProvider } from "../../../../Contexts/StatusContext"; import { StatusProvider } from "../../../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../../../Contexts/UserContext"; import { UserProvider, setToken } from "../../../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../../../utils/snapshot";
const renderFleetCANFiltersTable = async () => { const renderFleetCANFiltersTable = async () => {
const { container } = render( const { container } = render(
@@ -26,11 +27,15 @@ const renderFleetCANFiltersTable = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { }); await waitFor(() => {});
return container; return container;
}; };
describe("FleetCANFiltersTable", () => { describe("FleetCANFiltersTable", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetCANFiltersTable(); const container = await renderFleetCANFiltersTable();

View File

@@ -15,11 +15,11 @@ exports[`FleetCANFilterUpdate Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -56,10 +56,10 @@ exports[`FleetCANFilterUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
Fleet Name Fleet Name
@@ -103,10 +103,10 @@ exports[`FleetCANFilterUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
CAN ID CAN ID
@@ -149,10 +149,10 @@ exports[`FleetCANFilterUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
Interval Interval
@@ -163,7 +163,7 @@ exports[`FleetCANFilterUpdate Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { FleetProvider } from "../../../../Contexts/FleetContext";
import { StatusProvider } from "../../../../Contexts/StatusContext"; import { StatusProvider } from "../../../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../../../Contexts/UserContext"; import { UserProvider, setToken } from "../../../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../../../utils/snapshot";
const renderFleetCANFilterUpdate = async () => { const renderFleetCANFilterUpdate = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,15 @@ const renderFleetCANFilterUpdate = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { }); await waitFor(() => {});
return container; return container;
}; };
describe("FleetCANFilterUpdate", () => { describe("FleetCANFilterUpdate", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetCANFilterUpdate(); const container = await renderFleetCANFilterUpdate();

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/FleetContext"); jest.mock("../../Contexts/FleetContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -10,7 +10,8 @@ import { BrowserRouter } from "react-router-dom";
import { setToken } from "../../Contexts/UserContext"; import { setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import CANFiltersTab from "./CANFiltersTab" import CANFiltersTab from "./CANFiltersTab";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCANFitlersTab = async () => { const renderCANFitlersTab = async () => {
const { container } = render( const { container } = render(
@@ -18,11 +19,17 @@ const renderCANFitlersTab = async () => {
<CANFiltersTab name="US-TEST" /> <CANFiltersTab name="US-TEST" />
</BrowserRouter> </BrowserRouter>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("CANFiltersTab", () => { describe("CANFiltersTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderCANFitlersTab(); const container = await renderCANFitlersTab();

View File

@@ -15,13 +15,13 @@ exports[`FleetDetailsTab Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<p> <p>
<b> <b>
@@ -45,7 +45,7 @@ exports[`FleetDetailsTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<b> <b>
CANBus CANBus
@@ -87,7 +87,7 @@ exports[`FleetDetailsTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<a <a
class="" class=""

View File

@@ -9,7 +9,8 @@ import { FleetProvider } from "../../../Contexts/FleetContext";
import { StatusProvider } from "../../../Contexts/StatusContext"; import { StatusProvider } from "../../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../../Contexts/UserContext"; import { UserProvider, setToken } from "../../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../../utils/snapshot";
const renderFleetDetailsTab = async () => { const renderFleetDetailsTab = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,17 @@ const renderFleetDetailsTab = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("FleetDetailsTab", () => { describe("FleetDetailsTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetDetailsTab(); const container = await renderFleetDetailsTab();

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/FleetContext"); jest.mock("../../Contexts/FleetContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,27 +12,34 @@ import { FleetProvider } from "../../Contexts/FleetContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./DetailsTab" import MainForm from "./DetailsTab";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderDetailsTab = async () => { const renderDetailsTab = async () => {
const { container } = render( const { container } = render(
<FleetProvider> <FleetProvider>
<StatusProvider> <StatusProvider>
<UserProvider> <UserProvider>
<MemoryRouter initialEntries={['/testroute/US-TEST']}> <MemoryRouter initialEntries={["/testroute/US-TEST"]}>
<Route path="/testroute/:name"> <Route path="/testroute/:name">
<MainForm name="US-TEST" /> <MainForm name="US-TEST" />
</Route> </Route>
</MemoryRouter > </MemoryRouter>
</UserProvider> </UserProvider>
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("DetailsTab", () => { describe("DetailsTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderDetailsTab(); const container = await renderDetailsTab();

View File

@@ -15,11 +15,11 @@ exports[`FleetVehicleAdd Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -55,10 +55,10 @@ exports[`FleetVehicleAdd Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
VIN VIN
@@ -69,7 +69,7 @@ exports[`FleetVehicleAdd Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { FleetProvider } from "../../../../Contexts/FleetContext";
import { StatusProvider } from "../../../../Contexts/StatusContext"; import { StatusProvider } from "../../../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../../../Contexts/UserContext"; import { UserProvider, setToken } from "../../../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../../../utils/snapshot";
const renderFleetVehicleAdd = async () => { const renderFleetVehicleAdd = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,17 @@ const renderFleetVehicleAdd = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("FleetVehicleAdd", () => { describe("FleetVehicleAdd", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetVehicleAdd(); const container = await renderFleetVehicleAdd();

View File

@@ -15,16 +15,16 @@ exports[`FleetVehiclesTable Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textJustifyAlign-47 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<a <a
class="makeStyles-labelInline-9" class="makeStyles-labelInline-0"
href="/fleet/undefined/vehicle-add" href="/fleet/undefined/vehicle-add"
> >
<svg <svg
@@ -41,10 +41,10 @@ exports[`FleetVehiclesTable Render 1`] = `
</div> </div>
<div <div
align="right" align="right"
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-8" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-8"
> >
<div <div
class="MuiFormControl-root makeStyles-margin-28 makeStyles-fullWidth-50" class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"
> >
<label <label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated"

View File

@@ -1,8 +1,8 @@
jest.mock("../../../../Contexts/FleetContext"); jest.mock("../../../../Contexts/FleetContext");
jest.mock("../../../../Contexts/StatusContext"); jest.mock("../../../../Contexts/StatusContext");
jest.mock("../../../../Contexts/UserContext"); jest.mock("../../../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,7 +12,8 @@ import { FleetProvider } from "../../../../Contexts/FleetContext";
import { StatusProvider } from "../../../../Contexts/StatusContext"; import { StatusProvider } from "../../../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../../../Contexts/UserContext"; import { UserProvider, setToken } from "../../../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../../../utils/snapshot";
const renderFleetVehiclesTable = async () => { const renderFleetVehiclesTable = async () => {
const { container } = render( const { container } = render(
@@ -26,11 +27,17 @@ const renderFleetVehiclesTable = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("FleetVehiclesTable", () => { describe("FleetVehiclesTable", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetVehiclesTable(); const container = await renderFleetVehiclesTable();

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/FleetContext"); jest.mock("../../Contexts/FleetContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -10,7 +10,8 @@ import { BrowserRouter } from "react-router-dom";
import { setToken } from "../../Contexts/UserContext"; import { setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import VehiclesTab from "./VehiclesTab" import VehiclesTab from "./VehiclesTab";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderVehiclesTab = async () => { const renderVehiclesTab = async () => {
const { container } = render( const { container } = render(
@@ -18,11 +19,17 @@ const renderVehiclesTab = async () => {
<VehiclesTab name="US-TEST" /> <VehiclesTab name="US-TEST" />
</BrowserRouter> </BrowserRouter>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("VehiclesTab", () => { describe("VehiclesTab", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderVehiclesTab(); const container = await renderVehiclesTab();

View File

@@ -3,7 +3,7 @@
exports[`CANFiltersTab Render 1`] = ` exports[`CANFiltersTab Render 1`] = `
<div> <div>
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -14,16 +14,16 @@ exports[`CANFiltersTab Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textJustifyAlign-47 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<a <a
class="makeStyles-labelInline-9" class="makeStyles-labelInline-0"
href="/fleet/undefined/filter-add" href="/fleet/undefined/filter-add"
> >
<svg <svg
@@ -40,10 +40,10 @@ exports[`CANFiltersTab Render 1`] = `
</div> </div>
<div <div
align="right" align="right"
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-8" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-8"
> >
<div <div
class="MuiFormControl-root makeStyles-margin-28 makeStyles-fullWidth-50" class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"
> >
<label <label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated"

View File

@@ -12,7 +12,7 @@ exports[`DetailsTab Render 1`] = `
data-testid="mocked-userprovider" data-testid="mocked-userprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -23,13 +23,13 @@ exports[`DetailsTab Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<p> <p>
<b> <b>
@@ -54,7 +54,7 @@ exports[`DetailsTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<b> <b>
CANBus CANBus
@@ -96,7 +96,7 @@ exports[`DetailsTab Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<a <a
class="" class=""

View File

@@ -3,7 +3,7 @@
exports[`VehiclesTab Render 1`] = ` exports[`VehiclesTab Render 1`] = `
<div> <div>
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -14,16 +14,16 @@ exports[`VehiclesTab Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textJustifyAlign-47 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<a <a
class="makeStyles-labelInline-9" class="makeStyles-labelInline-0"
href="/fleet/undefined/vehicle-add" href="/fleet/undefined/vehicle-add"
> >
<svg <svg
@@ -40,10 +40,10 @@ exports[`VehiclesTab Render 1`] = `
</div> </div>
<div <div
align="right" align="right"
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-8" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-8"
> >
<div <div
class="MuiFormControl-root makeStyles-margin-28 makeStyles-fullWidth-50" class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"
> >
<label <label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated"

View File

@@ -12,10 +12,10 @@ exports[`FleetStatus Render 1`] = `
data-testid="mocked-userprovider" data-testid="mocked-userprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiBox-root MuiBox-root-62 makeStyles-tableToolbar-30" class="MuiBox-root MuiBox-root-63 makeStyles-tableToolbar-0"
> >
<div <div
class="MuiTabs-root" class="MuiTabs-root"
@@ -85,7 +85,7 @@ exports[`FleetStatus Render 1`] = `
</button> </button>
</div> </div>
<span <span
class="PrivateTabIndicator-root-63 PrivateTabIndicator-colorSecondary-65 MuiTabs-indicator" class="PrivateTabIndicator-root-64 PrivateTabIndicator-colorSecondary-66 MuiTabs-indicator"
style="left: 0px; width: 0px;" style="left: 0px; width: 0px;"
/> />
</div> </div>
@@ -97,10 +97,10 @@ exports[`FleetStatus Render 1`] = `
role="tabpanel" role="tabpanel"
> >
<div <div
class="MuiBox-root MuiBox-root-67" class="MuiBox-root MuiBox-root-68"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<h6 <h6
class="MuiTypography-root MuiTypography-h6" class="MuiTypography-root MuiTypography-h6"
@@ -111,13 +111,13 @@ exports[`FleetStatus Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<p> <p>
<b> <b>
@@ -141,7 +141,7 @@ exports[`FleetStatus Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<b> <b>
CANBus CANBus
@@ -183,7 +183,7 @@ exports[`FleetStatus Render 1`] = `
</p> </p>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-12" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-12"
> >
<a <a
class="" class=""

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/FleetContext"); jest.mock("../../Contexts/FleetContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,7 +12,8 @@ import { FleetProvider } from "../../Contexts/FleetContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import FleetStatus from "./index" import FleetStatus from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderCarStatus = async () => { const renderCarStatus = async () => {
const { container } = render( const { container } = render(
@@ -26,11 +27,17 @@ const renderCarStatus = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("FleetStatus", () => { describe("FleetStatus", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderCarStatus(); const container = await renderCarStatus();

View File

@@ -15,16 +15,16 @@ exports[`FleetTable Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="MuiGrid-root makeStyles-root-14 MuiGrid-container MuiGrid-spacing-xs-2" class="MuiGrid-root makeStyles-root-0 MuiGrid-container MuiGrid-spacing-xs-2"
> >
<div <div
class="MuiGrid-root makeStyles-textJustifyAlign-47 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<a <a
class="makeStyles-labelInline-9" class="makeStyles-labelInline-0"
href="/fleet-add" href="/fleet-add"
> >
<svg <svg
@@ -41,10 +41,10 @@ exports[`FleetTable Render 1`] = `
</div> </div>
<div <div
align="right" align="right"
class="MuiGrid-root makeStyles-textCenterAlign-48 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-4"
> >
<div <div
class="MuiFormControl-root makeStyles-margin-28 makeStyles-fullWidth-50" class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"
> >
<label <label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated"
@@ -95,7 +95,7 @@ exports[`FleetTable Render 1`] = `
</div> </div>
</div> </div>
<div <div
class="MuiGrid-root makeStyles-textRightAlign-49 MuiGrid-item MuiGrid-grid-md-4" class="MuiGrid-root makeStyles-textRightAlign-0 MuiGrid-item MuiGrid-grid-md-4"
/> />
</div> </div>
<table <table

View File

@@ -1,8 +1,8 @@
jest.mock("../../Contexts/FleetContext"); jest.mock("../../Contexts/FleetContext");
jest.mock("../../Contexts/StatusContext"); jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext"); jest.mock("../../Contexts/UserContext");
jest.mock('@material-ui/core/utils/unstable_useId', () => jest.mock("@material-ui/core/utils/unstable_useId", () =>
jest.fn().mockReturnValue('mui-test-id'), jest.fn().mockReturnValue("mui-test-id")
); );
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
@@ -12,7 +12,8 @@ import { FleetProvider } from "../../Contexts/FleetContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderFleetTable = async () => { const renderFleetTable = async () => {
const { container } = render( const { container } = render(
@@ -26,11 +27,17 @@ const renderFleetTable = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("FleetTable", () => { describe("FleetTable", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetTable(); const container = await renderFleetTable();

View File

@@ -15,11 +15,11 @@ exports[`FleetUpdate Render 1`] = `
data-testid="mocked-fleetprovider" data-testid="mocked-fleetprovider"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="{onSubmit}" action="{onSubmit}"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -57,10 +57,10 @@ exports[`FleetUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64" class="PrivateNotchedOutline-legendLabelled-65"
> >
<span> <span>
Name Name
@@ -87,19 +87,19 @@ exports[`FleetUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="trace" value="trace"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -113,7 +113,7 @@ exports[`FleetUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -138,19 +138,19 @@ exports[`FleetUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="debug" value="debug"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -164,7 +164,7 @@ exports[`FleetUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -189,20 +189,20 @@ exports[`FleetUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
checked="" checked=""
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="info" value="info"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70 PrivateRadioButtonIcon-checked-72" class="PrivateRadioButtonIcon-root-71 PrivateRadioButtonIcon-checked-73"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -216,7 +216,7 @@ exports[`FleetUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -241,19 +241,19 @@ exports[`FleetUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="warn" value="warn"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -267,7 +267,7 @@ exports[`FleetUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -292,19 +292,19 @@ exports[`FleetUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="error" value="error"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -318,7 +318,7 @@ exports[`FleetUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -343,19 +343,19 @@ exports[`FleetUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiRadio-root MuiRadio-colorSecondary MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
name="log-level-group" name="log-level-group"
type="radio" type="radio"
value="critical" value="critical"
/> />
<div <div
class="PrivateRadioButtonIcon-root-70" class="PrivateRadioButtonIcon-root-71"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@@ -369,7 +369,7 @@ exports[`FleetUpdate Render 1`] = `
</svg> </svg>
<svg <svg
aria-hidden="true" aria-hidden="true"
class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-71" class="MuiSvgIcon-root PrivateRadioButtonIcon-layer-72"
focusable="false" focusable="false"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@@ -404,14 +404,14 @@ exports[`FleetUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
checked="" checked=""
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
data-indeterminate="false" data-indeterminate="false"
type="checkbox" type="checkbox"
value="" value=""
@@ -470,10 +470,10 @@ exports[`FleetUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Max Memory Buffer Size (0 uses default size) Max Memory Buffer Size (0 uses default size)
@@ -488,13 +488,13 @@ exports[`FleetUpdate Render 1`] = `
> >
<span <span
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-66 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-67 Mui-checked MuiIconButton-colorSecondary" class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-67 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-checked-68 Mui-checked MuiIconButton-colorSecondary"
> >
<span <span
class="MuiIconButton-label" class="MuiIconButton-label"
> >
<input <input
class="PrivateSwitchBase-input-69" class="PrivateSwitchBase-input-70"
data-indeterminate="false" data-indeterminate="false"
type="checkbox" type="checkbox"
value="" value=""
@@ -554,10 +554,10 @@ exports[`FleetUpdate Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Max Disk Buffer Size (0 uses default size) Max Disk Buffer Size (0 uses default size)
@@ -568,7 +568,7 @@ exports[`FleetUpdate Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -9,7 +9,8 @@ import { FleetProvider } from "../../Contexts/FleetContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index" import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderFleetUpdate = async () => { const renderFleetUpdate = async () => {
const { container } = render( const { container } = render(
@@ -23,11 +24,17 @@ const renderFleetUpdate = async () => {
</StatusProvider> </StatusProvider>
</FleetProvider> </FleetProvider>
); );
await waitFor(() => { /* render */ }); await waitFor(() => {
/* render */
});
return container; return container;
}; };
describe("FleetUpdate", () => { describe("FleetUpdate", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderFleetUpdate(); const container = await renderFleetUpdate();

View File

@@ -8,7 +8,6 @@ const Home = () => {
const classes = useStyles(); const classes = useStyles();
const { setTitle, setSitePath } = useStatusContext(); const { setTitle, setSitePath } = useStatusContext();
useEffect(() => { useEffect(() => {
setTitle("Home"); setTitle("Home");
setSitePath([]); setSitePath([]);

View File

@@ -12,7 +12,6 @@ import ListItemLink from "../ListItemLink";
import ListItemExternalLink from "../ListItemExternalLink"; import ListItemExternalLink from "../ListItemExternalLink";
import { useUserContext } from "../Contexts/UserContext"; import { useUserContext } from "../Contexts/UserContext";
import { Roles, hasRole } from "../../utils/roles"; import { Roles, hasRole } from "../../utils/roles";
import { SupersetDashboardURL } from "../../services/superset";
const menuData = [ const menuData = [
{ {
@@ -41,7 +40,7 @@ const menuData = [
}, },
{ {
label: "Datascope", label: "Datascope",
url: SupersetDashboardURL, to: "/datascope",
icon: <AssessmentIcon />, icon: <AssessmentIcon />,
roles: [Roles.READ, Roles.CREATE], roles: [Roles.READ, Roles.CREATE],
}, },
@@ -66,10 +65,9 @@ const menuData = [
label: "SMS", label: "SMS",
to: "/tools/sms/send", to: "/tools/sms/send",
roles: [], roles: [],
} },
], ],
}, },
]; ];
const MenuItem = ({ item, children }) => { const MenuItem = ({ item, children }) => {

View File

@@ -5,6 +5,7 @@ import { BrowserRouter } from "react-router-dom";
import { UserProvider, setToken } from "../Contexts/UserContext"; import { UserProvider, setToken } from "../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../utils/testing";
import SideMenu from "./SideMenu"; import SideMenu from "./SideMenu";
import addSnapshotSerializer from "../../utils/snapshot";
const renderMenu = async () => { const renderMenu = async () => {
const { container } = render( const { container } = render(
@@ -19,6 +20,10 @@ const renderMenu = async () => {
}; };
describe("SideMenu", () => { describe("SideMenu", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Unauthenticated", async () => { it("Unauthenticated", async () => {
setToken(null); setToken(null);
const container = await renderMenu(); const container = await renderMenu();

View File

@@ -155,12 +155,10 @@ exports[`SideMenu Authenticated 1`] = `
<li> <li>
<a <a
aria-disabled="false" aria-disabled="false"
class="MuiTypography-root MuiLink-root MuiLink-underlineHover MuiButtonBase-root MuiListItem-root makeStyles-menuExternalLink-52 MuiListItem-gutters MuiListItem-button MuiTypography-colorPrimary" class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
href="https://dev-superset.cloud.fiskerinc.com/r/3" href="/datascope"
rel="noopener"
role="button" role="button"
tabindex="0" tabindex="0"
target="_blank"
> >
<div <div
class="MuiListItemIcon-root" class="MuiListItemIcon-root"

View File

@@ -12,7 +12,7 @@ Object {
data-testid="mocked-manifestsprovider" data-testid="mocked-manifestsprovider"
> >
<div <div
class="makeStyles-link-26" class="makeStyles-link-0"
> >
Show Details Show Details
</div> </div>
@@ -28,7 +28,7 @@ Object {
data-testid="mocked-manifestsprovider" data-testid="mocked-manifestsprovider"
> >
<div <div
class="makeStyles-link-26" class="makeStyles-link-0"
> >
Show Details Show Details
</div> </div>
@@ -101,7 +101,7 @@ Object {
data-testid="mocked-manifestsprovider" data-testid="mocked-manifestsprovider"
> >
<div <div
class="makeStyles-link-87" class="makeStyles-link-0"
> >
Hide Details Hide Details
</div> </div>
@@ -156,7 +156,7 @@ Object {
data-testid="mocked-manifestsprovider" data-testid="mocked-manifestsprovider"
> >
<div <div
class="makeStyles-link-87" class="makeStyles-link-0"
> >
Hide Details Hide Details
</div> </div>

View File

@@ -10,6 +10,7 @@ import { UserProvider, setToken } from "../../Contexts/UserContext";
import { StatusProvider } from "../../Contexts/StatusContext"; import { StatusProvider } from "../../Contexts/StatusContext";
import ManifestDetails from "."; import ManifestDetails from ".";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import addSnapshotSerializer from "../../../utils/snapshot";
const TestComponent = (opened) => ( const TestComponent = (opened) => (
<UserProvider> <UserProvider>
@@ -26,6 +27,7 @@ const TestComponent = (opened) => (
describe("Manifest Details Component", () => { describe("Manifest Details Component", () => {
beforeAll(() => { beforeAll(() => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
addSnapshotSerializer(expect);
}); });
it("Render Hidden", async () => { it("Render Hidden", async () => {

View File

@@ -37,7 +37,7 @@ const CertificateCreate = React.lazy(() => import("../Certificates/Add"));
const SMSSend = React.lazy(() => import("../SMS/Send")); const SMSSend = React.lazy(() => import("../SMS/Send"));
const SuppliersList = React.lazy(() => import("../Suppliers/List")); const SuppliersList = React.lazy(() => import("../Suppliers/List"));
const SupplierDetails = React.lazy(() => import("../Suppliers/Details")); const SupplierDetails = React.lazy(() => import("../Suppliers/Details"));
const Datascope = React.lazy(() => import("../Dashboard"));
const SiteRoutes = () => { const SiteRoutes = () => {
const { token, groups } = useUserContext(); const { token, groups } = useUserContext();
return ( return (
@@ -233,6 +233,14 @@ const SiteRoutes = () => {
groups={groups} groups={groups}
roles={[Roles.APPROVESUPPLIERS]} roles={[Roles.APPROVESUPPLIERS]}
/> />
<AuthRoute
path="/datascope"
render={() => <Datascope />}
type={TYPES.PROTECTED}
token={token}
groups={groups}
roles={[Roles.READ, Roles.CREATE]}
/>
<PageNotFound /> <PageNotFound />
</Switch> </Switch>
</Suspense> </Suspense>

View File

@@ -2,11 +2,13 @@ import React from "react";
import { render, waitFor } from "@testing-library/react"; import { render, waitFor } from "@testing-library/react";
import ViewResult from "./ViewResult"; import ViewResult from "./ViewResult";
import addSnapshotSerializer from "../../../utils/snapshot";
describe("ViewResult", () => { describe("ViewResult", () => {
beforeAll(() => { beforeAll(() => {
global.URL.createObjectURL = jest.fn(); global.URL.createObjectURL = jest.fn();
global.URL.revokeObjectURL = jest.fn(); global.URL.revokeObjectURL = jest.fn();
addSnapshotSerializer(expect);
}); });
it("Render", async () => { it("Render", async () => {

View File

@@ -21,7 +21,7 @@ exports[`ViewResult Render 1`] = `
</li> </li>
</ul> </ul>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -4,8 +4,13 @@ import React from "react";
import { BrowserRouter } from "react-router-dom"; import { BrowserRouter } from "react-router-dom";
import { render, cleanup } from "@testing-library/react"; import { render, cleanup } from "@testing-library/react";
import SSOForm from "./index"; import SSOForm from "./index";
import addSnapshotSerializer from "../../utils/snapshot";
describe("Sign In Form", () => { describe("Sign In Form", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Should render", () => { it("Should render", () => {
const { container } = render( const { container } = render(
<BrowserRouter> <BrowserRouter>

View File

@@ -3,11 +3,11 @@
exports[`Sign In Form Should render 1`] = ` exports[`Sign In Form Should render 1`] = `
<div> <div>
<div <div
class="makeStyles-paper-3 makeStyles-textJustifyAlign-47" class="makeStyles-paper-0 makeStyles-textJustifyAlign-0"
> >
<a <a
aria-disabled="false" aria-disabled="false"
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary"
href="https://cognito.com/authorize?redirect=https://example.com/callback" href="https://cognito.com/authorize?redirect=https://example.com/callback"
tabindex="0" tabindex="0"
> >

View File

@@ -12,11 +12,11 @@ exports[`Supplier page Render 1`] = `
id="mock-browserrouter" id="mock-browserrouter"
> >
<div <div
class="makeStyles-paper-3" class="makeStyles-paper-0"
> >
<form <form
action="#" action="#"
class="makeStyles-form-5" class="makeStyles-form-0"
novalidate="" novalidate=""
> >
<div <div
@@ -52,10 +52,10 @@ exports[`Supplier page Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Contact Contact
@@ -98,10 +98,10 @@ exports[`Supplier page Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Company Company
@@ -144,10 +144,10 @@ exports[`Supplier page Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Address Address
@@ -190,10 +190,10 @@ exports[`Supplier page Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Telephone Telephone
@@ -236,10 +236,10 @@ exports[`Supplier page Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
Program Program
@@ -282,10 +282,10 @@ exports[`Supplier page Render 1`] = `
/> />
<fieldset <fieldset
aria-hidden="true" aria-hidden="true"
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline" class="PrivateNotchedOutline-root-63 MuiOutlinedInput-notchedOutline"
> >
<legend <legend
class="PrivateNotchedOutline-legendLabelled-64 PrivateNotchedOutline-legendNotched-65" class="PrivateNotchedOutline-legendLabelled-65 PrivateNotchedOutline-legendNotched-66"
> >
<span> <span>
ECUs ECUs
@@ -296,7 +296,7 @@ exports[`Supplier page Render 1`] = `
</div> </div>
</div> </div>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedSecondary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedSecondary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="button" type="button"
> >
@@ -310,7 +310,7 @@ exports[`Supplier page Render 1`] = `
/> />
</button> </button>
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth" class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
tabindex="0" tabindex="0"
type="submit" type="submit"
> >

View File

@@ -17,6 +17,7 @@ import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index"; import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderSupplierDetailsPage = async () => { const renderSupplierDetailsPage = async () => {
const { container } = render( const { container } = render(
@@ -37,6 +38,10 @@ const renderSupplierDetailsPage = async () => {
}; };
describe("Supplier page", () => { describe("Supplier page", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderSupplierDetailsPage(); const container = await renderSupplierDetailsPage();

View File

@@ -9,10 +9,10 @@ exports[`Suppliers page Render 1`] = `
data-testid="mocked-userprovider" data-testid="mocked-userprovider"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<div <div
class="makeStyles-paper-3 makeStyles-tableSize-53" class="makeStyles-paper-0 makeStyles-tableSize-0"
> >
<table <table
class="MuiTable-root" class="MuiTable-root"
@@ -151,7 +151,7 @@ exports[`Suppliers page Render 1`] = `
> >
Registered Registered
<span <span
class="makeStyles-hiddenSortSpan-27" class="makeStyles-hiddenSortSpan-0"
> >
sorted ascending sorted ascending
</span> </span>

View File

@@ -12,6 +12,7 @@ import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext"; import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing"; import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./index"; import MainForm from "./index";
import addSnapshotSerializer from "../../../utils/snapshot";
const renderSuppliersPage = async () => { const renderSuppliersPage = async () => {
const { container } = render( const { container } = render(
@@ -32,6 +33,10 @@ const renderSuppliersPage = async () => {
}; };
describe("Suppliers page", () => { describe("Suppliers page", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => { it("Render", async () => {
setToken(TEST_AUTH_OBJECT); setToken(TEST_AUTH_OBJECT);
const container = await renderSuppliersPage(); const container = await renderSuppliersPage();

View File

@@ -171,6 +171,15 @@ const useStyles = makeStyles((theme) => ({
grow: { grow: {
flexGrow: 1, flexGrow: 1,
}, },
iframeResponsive: {
position: "absolute",
top: 0,
left: 0,
bottom: 0,
right: 0,
width: "100%",
height: "100%",
},
embeddedWrapper: { embeddedWrapper: {
marginTop: 10, marginTop: 10,
position: "relative", position: "relative",

35
src/utils/snapshot.js Normal file
View File

@@ -0,0 +1,35 @@
const rxMakeStyles = /makeStyles-(\w+)-(\d+)/gi;
const rxMUIStyles = /mui-\d*/g;
const snapshotSerializers = [
{
test: (val) => {
return val && typeof val === "string" && val.indexOf("mui-") > -1;
},
print: (val) => {
let str = val;
str = str.replace(rxMUIStyles, "mui-0");
return `"${str}"`;
},
},
{
test: (val) => {
return val && typeof val === "string" && val.search(rxMakeStyles) > -1;
},
print: (val) => {
let str = val;
str = str.replace(rxMakeStyles, "makeStyles-$1-0");
return `"${str}"`;
},
},
];
const addSnapshotSerializer = (expect) => {
snapshotSerializers.forEach((serializer) => {
expect.addSnapshotSerializer(serializer);
});
};
export default addSnapshotSerializer;