Merge branch 'Release/0.0.3'
This commit is contained in:
2
.env.dev
2
.env.dev
@@ -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=https://superset-dev.cloud.fiskerinc.com/superset/dashboard/8/?native_filters_key=KPnPthpLQ8rT--6PUdsPzQAcwnleRGHk_3dg0PVYfrXc3SE6zZ2x0p7JuerAZ0Pg
|
||||||
|
|||||||
@@ -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=https://superset-dev.cloud.fiskerinc.com/superset/dashboard/8/?native_filters_key=KPnPthpLQ8rT--6PUdsPzQAcwnleRGHk_3dg0PVYfrXc3SE6zZ2x0p7JuerAZ0Pg
|
||||||
|
|||||||
2
.env.prd
2
.env.prd
@@ -2,4 +2,4 @@ REACT_APP_AUTH_SERVICE_URL=https://gw.cloud.fiskerinc.com/compute_auth
|
|||||||
REACT_APP_CERT_SERVICE_URL=https://gw.cloud.fiskerinc.com/certificate
|
REACT_APP_CERT_SERVICE_URL=https://gw.cloud.fiskerinc.com/certificate
|
||||||
REACT_APP_UPLOAD_SERVICE_URL=https://gw.cloud.fiskerinc.com/ota_update
|
REACT_APP_UPLOAD_SERVICE_URL=https://gw.cloud.fiskerinc.com/ota_update
|
||||||
REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.cloud.fiskerinc.com
|
REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.cloud.fiskerinc.com
|
||||||
REACT_APP_SUPERSET_URL=https://superset.cloud.fiskerinc.com
|
REACT_APP_SUPERSET_URL=https://superset.cloud.fiskerinc.com/superset/dashboard/9/?native_filters_key=mfJ1VjGTcLUKz7gQs_DgClZhjcdNucYMrPruNibcyDnhkDwdHbAumBRVTpA5tFH_
|
||||||
|
|||||||
2
.env.stg
2
.env.stg
@@ -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=https://stg-superset.cloud.fiskerinc.com/superset/dashboard/6/?native_filters_key=XBwRgJIvmxhqBhqlz45kuTnXc1iUY_M_ovzXCzXy5_l-AOFAXEaGLWpYIsfrEHGR
|
||||||
|
|||||||
@@ -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(() => {
|
||||||
@@ -132,6 +109,10 @@ describe("App", () => {
|
|||||||
await check("/tools/certificates/add", "span.MuiButton-label", "Sign In");
|
await check("/tools/certificates/add", "span.MuiButton-label", "Sign In");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Route /tools/sms/send unauthenticated", async () => {
|
||||||
|
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");
|
||||||
});
|
});
|
||||||
@@ -189,4 +170,9 @@ describe("App", () => {
|
|||||||
setToken(TEST_AUTH_OBJECT);
|
setToken(TEST_AUTH_OBJECT);
|
||||||
await check("/tools/certificates/add", "h6", "Create Certificate");
|
await check("/tools/certificates/add", "h6", "Create Certificate");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Route /tools/sms/send authenticated", async () => {
|
||||||
|
setToken(TEST_AUTH_OBJECT);
|
||||||
|
await check("/tools/sms/send", "h6", "Send SMS");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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,7 +21,8 @@ const renderCANFiltersAdd = async () => {
|
|||||||
<MainForm />
|
<MainForm />
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</UserProvider>
|
</UserProvider>
|
||||||
</StatusProvider>f
|
</StatusProvider>
|
||||||
|
f
|
||||||
</CANFiltersProvider>
|
</CANFiltersProvider>
|
||||||
);
|
);
|
||||||
await waitFor(() => {});
|
await waitFor(() => {});
|
||||||
@@ -28,6 +30,10 @@ const renderCANFiltersAdd = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import useStyles from "../../useStyles";
|
|||||||
import SearchField from "../../Controls/SearchField";
|
import SearchField from "../../Controls/SearchField";
|
||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
import { Roles, hasRole } from "../../../utils/roles";
|
import { Roles, hasRole } from "../../../utils/roles";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -44,9 +45,11 @@ const tableColumns = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE = "CAN_FILTER_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const MainForm = ({ vin }) => {
|
const MainForm = ({ vin }) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("id");
|
const [orderBy, setOrderBy] = useState("id");
|
||||||
const [order, setOrder] = useState("desc");
|
const [order, setOrder] = useState("desc");
|
||||||
|
|||||||
@@ -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(
|
||||||
@@ -31,6 +32,10 @@ const renderCANFiltersTable = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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(
|
||||||
@@ -28,6 +29,10 @@ const renderCANFiltersUpdate = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
104
src/components/Cars/CANSignals/index.jsx
Normal file
104
src/components/Cars/CANSignals/index.jsx
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
import {
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableHead,
|
||||||
|
TableRow,
|
||||||
|
} from "@material-ui/core";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { logger } from "../../../services/monitoring";
|
||||||
|
import { LocalDateTimeString } from "../../../utils/dates";
|
||||||
|
|
||||||
|
import { useVehicleContext } from "../../Contexts/VehicleContext";
|
||||||
|
|
||||||
|
const BlankSignal = (msg) => ({
|
||||||
|
timestamp: "",
|
||||||
|
signal: msg,
|
||||||
|
value: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
const transformSignals = (signals) =>
|
||||||
|
signals
|
||||||
|
.map((signal) => {
|
||||||
|
const { Timestamp, ...Settings } = signal;
|
||||||
|
const keys = Object.keys(Settings);
|
||||||
|
|
||||||
|
return keys.map((key) => ({
|
||||||
|
timestamp: LocalDateTimeString(Timestamp),
|
||||||
|
signal: key,
|
||||||
|
value: Settings[key],
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
.flat();
|
||||||
|
|
||||||
|
const CANSignals = (props) => {
|
||||||
|
const { vin, token } = props;
|
||||||
|
const { getCANSignals } = useVehicleContext();
|
||||||
|
const [signals, setSignals] = useState([]);
|
||||||
|
const delay = 500;
|
||||||
|
let timer = 0;
|
||||||
|
|
||||||
|
const stopTimer = async () => {
|
||||||
|
if (timer === 0) return;
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
const startTimer = () => {
|
||||||
|
stopTimer();
|
||||||
|
timer = setTimeout(() => {
|
||||||
|
updateSignals();
|
||||||
|
}, delay);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateSignals = async () => {
|
||||||
|
try {
|
||||||
|
const result = await getCANSignals(vin, token);
|
||||||
|
const items = transformSignals(result.data);
|
||||||
|
|
||||||
|
if (items.length > 0) {
|
||||||
|
setSignals(items);
|
||||||
|
} else {
|
||||||
|
setSignals([BlankSignal("No signals")]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delay > 0) startTimer();
|
||||||
|
} catch (e) {
|
||||||
|
setSignals([BlankSignal(e.message)]);
|
||||||
|
logger.warn(e.stack);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
startTimer();
|
||||||
|
return () => {
|
||||||
|
stopTimer();
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (!signals || signals.length === 0) return <h3>Loading...</h3>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table>
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>Timestamp</TableCell>
|
||||||
|
<TableCell>Signal</TableCell>
|
||||||
|
<TableCell>Value</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{signals.map((signal, i) => (
|
||||||
|
<TableRow key={i}>
|
||||||
|
<TableCell>{signal.timestamp}</TableCell>
|
||||||
|
<TableCell>{signal.signal}</TableCell>
|
||||||
|
<TableCell>{signal.value}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CANSignals;
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
35
src/components/Cars/Status/CANSignalsTab.jsx
Normal file
35
src/components/Cars/Status/CANSignalsTab.jsx
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import React from "react";
|
||||||
|
import clsx from "clsx";
|
||||||
|
import { Typography } from "@material-ui/core";
|
||||||
|
|
||||||
|
import useStyles from "../../useStyles";
|
||||||
|
import { useUserContext } from "../../Contexts/UserContext";
|
||||||
|
import CANSignals from "../CANSignals";
|
||||||
|
import { VehicleProvider } from "../../Contexts/VehicleContext";
|
||||||
|
|
||||||
|
const Main = (props) => {
|
||||||
|
const {
|
||||||
|
token: {
|
||||||
|
idToken: { jwtToken: token },
|
||||||
|
},
|
||||||
|
} = useUserContext();
|
||||||
|
const classes = useStyles();
|
||||||
|
const { vin } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={clsx(classes.paper, classes.tableSize)}>
|
||||||
|
<Typography variant="h6" style={{ paddingBottom: "10px" }}>
|
||||||
|
CAN Signals
|
||||||
|
</Typography>
|
||||||
|
<CANSignals vin={vin} token={token} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const CANSignalsTab = (props) => (
|
||||||
|
<VehicleProvider>
|
||||||
|
<Main {...props} />
|
||||||
|
</VehicleProvider>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default CANSignalsTab;
|
||||||
@@ -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();
|
||||||
|
|||||||
@@ -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=""
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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,14 +12,15 @@ 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>
|
||||||
@@ -28,11 +29,17 @@ const renderDetailsTab = async () => {
|
|||||||
</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();
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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=""
|
||||||
|
|||||||
@@ -1,143 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`DigitalTwinTab Render 1`] = `
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
data-testid="mocked-statusprovider"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
data-testid="mocked-userprovider"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
data-testid="mocked-vehicleprovider"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="makeStyles-paper-3 makeStyles-tableSize-53"
|
|
||||||
>
|
|
||||||
<h6
|
|
||||||
class="MuiTypography-root MuiTypography-h6"
|
|
||||||
style="padding-bottom: 10px;"
|
|
||||||
>
|
|
||||||
Digital Twin
|
|
||||||
</h6>
|
|
||||||
<div>
|
|
||||||
<b>
|
|
||||||
Connected
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
false
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
Battery
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
95%
|
|
||||||
</p>
|
|
||||||
<div
|
|
||||||
class="makeStyles-popupSection-40"
|
|
||||||
>
|
|
||||||
<h3>
|
|
||||||
Doors
|
|
||||||
</h3>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
hood
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
closed
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
left_front
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
closed
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
left_rear
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
closed
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
right_front
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
closed
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
right_rear
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
closed
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
trunk
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
closed
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="makeStyles-popupSection-40"
|
|
||||||
>
|
|
||||||
<h3>
|
|
||||||
Location
|
|
||||||
</h3>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
altitude
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
17
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
longitude
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
-122.414°
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
latitude
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
37.764°
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="makeStyles-popupSection-40"
|
|
||||||
>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
Trex Version
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
1000000
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="makeStyles-popupSection-40"
|
|
||||||
>
|
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
Updated at
|
|
||||||
</b>
|
|
||||||
:
|
|
||||||
7/26/2022 12:26:38 AM
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -83,27 +83,9 @@ exports[`CarStatus Render 1`] = `
|
|||||||
class="MuiTouchRipple-root"
|
class="MuiTouchRipple-root"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<button
|
|
||||||
aria-controls="tabpanel-3"
|
|
||||||
aria-selected="false"
|
|
||||||
class="MuiButtonBase-root MuiTab-root MuiTab-textColorInherit"
|
|
||||||
id="tab-3"
|
|
||||||
role="tab"
|
|
||||||
tabindex="-1"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="MuiTab-wrapper"
|
|
||||||
>
|
|
||||||
Digital Twin
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
class="MuiTouchRipple-root"
|
|
||||||
/>
|
|
||||||
</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 +97,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 +108,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 +124,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=""
|
||||||
@@ -197,12 +179,6 @@ exports[`CarStatus Render 1`] = `
|
|||||||
id="tabpanel-2"
|
id="tabpanel-2"
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
/>
|
/>
|
||||||
<div
|
|
||||||
aria-labelledby="tab-3"
|
|
||||||
hidden=""
|
|
||||||
id="tabpanel-3"
|
|
||||||
role="tabpanel"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import DigitalTwinTab from "./DigitalTwinTab";
|
|||||||
import TabPanel from "../../Controls/TabPanel";
|
import TabPanel from "../../Controls/TabPanel";
|
||||||
import { useStatusContext } from "../../Contexts/StatusContext";
|
import { useStatusContext } from "../../Contexts/StatusContext";
|
||||||
import useStyles from "../../useStyles";
|
import useStyles from "../../useStyles";
|
||||||
|
import CANSignalsTab from "./CANSignalsTab";
|
||||||
|
|
||||||
const tabHashes = ["details", "updates", "filters"];
|
const tabHashes = ["details", "updates", "filters"];
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ const CarStatus = () => {
|
|||||||
<Tab label="Car Updates" {...tabProps(1)} />
|
<Tab label="Car Updates" {...tabProps(1)} />
|
||||||
<Tab label="CAN Filters" {...tabProps(2)} />
|
<Tab label="CAN Filters" {...tabProps(2)} />
|
||||||
<Tab label="Digital Twin" {...tabProps(3)} />
|
<Tab label="Digital Twin" {...tabProps(3)} />
|
||||||
|
<Tab label="CAN Signals" {...tabProps(4)} />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@@ -80,6 +82,10 @@ const CarStatus = () => {
|
|||||||
<TabPanel value={tabIndex} index={3}>
|
<TabPanel value={tabIndex} index={3}>
|
||||||
<DigitalTwinTab vin={vin} />
|
<DigitalTwinTab vin={vin} />
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
|
||||||
|
<TabPanel value={tabIndex} index={4} className={classes.fullWidth}>
|
||||||
|
<CANSignalsTab vin={vin} />
|
||||||
|
</TabPanel>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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 () => {
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
63
src/components/Contexts/SMSContext.jsx
Normal file
63
src/components/Contexts/SMSContext.jsx
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import React, { useContext, useState } from "react";
|
||||||
|
|
||||||
|
import api from "../../services/smsAPI";
|
||||||
|
|
||||||
|
const SMSContext = React.createContext();
|
||||||
|
|
||||||
|
export class SMS {
|
||||||
|
constructor(message, ICCID, isAwaited) {
|
||||||
|
/** @type {string} */
|
||||||
|
this.messageText = message;
|
||||||
|
/** @type {string} */
|
||||||
|
this.ICCID = ICCID;
|
||||||
|
/** @type {boolean} */
|
||||||
|
this.await = isAwaited;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {SMS} data
|
||||||
|
*/
|
||||||
|
const validateSend = (data) => {
|
||||||
|
if (!data.messageText) throw new Error("message is required");
|
||||||
|
if (!data.ICCID) throw new Error("ICCID is required");
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SMSProvider = ({ children }) => {
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {SMS} data
|
||||||
|
* @param {*} token
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const sendSMS = async (data, token) => {
|
||||||
|
try {
|
||||||
|
setBusy(true);
|
||||||
|
|
||||||
|
validateSend(data);
|
||||||
|
|
||||||
|
const result = await api.send(data, token);
|
||||||
|
if (result.error) {
|
||||||
|
throw new Error(`Send message error. ${result.message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SMSContext.Provider
|
||||||
|
value={{
|
||||||
|
busy,
|
||||||
|
sendSMS,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</SMSContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useSMSContext = () => useContext(SMSContext);
|
||||||
@@ -205,6 +205,20 @@ export const VehicleProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getCANSignals = async (vin, token) => {
|
||||||
|
try {
|
||||||
|
setBusy(true);
|
||||||
|
validateVIN(vin);
|
||||||
|
|
||||||
|
const result = await api.getCANSignals(vin, token);
|
||||||
|
if (result.error)
|
||||||
|
throw new Error(`Get CAN signals error. ${result.message}`);
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<VehicleContext.Provider
|
<VehicleContext.Provider
|
||||||
value={{
|
value={{
|
||||||
@@ -217,6 +231,7 @@ export const VehicleProvider = ({ children }) => {
|
|||||||
addVehicle,
|
addVehicle,
|
||||||
deleteVehicle,
|
deleteVehicle,
|
||||||
getConnections,
|
getConnections,
|
||||||
|
getCANSignals,
|
||||||
getECUs,
|
getECUs,
|
||||||
getLocations,
|
getLocations,
|
||||||
getModels,
|
getModels,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import TableHeaderSortable from "../../Table/HeaderSortable";
|
|||||||
import { useVehicleContext } from "../../Contexts/VehicleContext";
|
import { useVehicleContext } from "../../Contexts/VehicleContext";
|
||||||
import { useStatusContext } from "../../Contexts/StatusContext";
|
import { useStatusContext } from "../../Contexts/StatusContext";
|
||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -42,10 +43,12 @@ const tableColumns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE = "CAR_ECUS_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const CarECUsTable = ({ vin, token, classes }) => {
|
const CarECUsTable = ({ vin, token, classes }) => {
|
||||||
const [ecus, setECUs] = useState([]);
|
const [ecus, setECUs] = useState([]);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("ecu");
|
const [orderBy, setOrderBy] = useState("ecu");
|
||||||
const [order, setOrder] = useState("desc");
|
const [order, setOrder] = useState("desc");
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import TableHeaderSortable from "../../Table/HeaderSortable";
|
|||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
import ConnectedIcon from "../../Controls/ConnectedIcon";
|
import ConnectedIcon from "../../Controls/ConnectedIcon";
|
||||||
import ECUList from "../../Controls/ECUList";
|
import ECUList from "../../Controls/ECUList";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -47,6 +48,8 @@ const tableColumns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE = "CAR_SELECTION_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const CarSelectionTable = (props) => {
|
const CarSelectionTable = (props) => {
|
||||||
const {
|
const {
|
||||||
token,
|
token,
|
||||||
@@ -57,7 +60,7 @@ const CarSelectionTable = (props) => {
|
|||||||
onSelect,
|
onSelect,
|
||||||
onSelectAll,
|
onSelectAll,
|
||||||
} = props;
|
} = props;
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("vin");
|
const [orderBy, setOrderBy] = useState("vin");
|
||||||
const [order, setOrder] = useState("asc");
|
const [order, setOrder] = useState("asc");
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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 () => {
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import TableHeaderSortable from "../../Table/HeaderSortable";
|
|||||||
import { useCarUpdatesContext } from "../../Contexts/CarUpdatesContext";
|
import { useCarUpdatesContext } from "../../Contexts/CarUpdatesContext";
|
||||||
import { useStatusContext } from "../../Contexts/StatusContext";
|
import { useStatusContext } from "../../Contexts/StatusContext";
|
||||||
import useStyles from "../../useStyles";
|
import useStyles from "../../useStyles";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -34,11 +35,13 @@ const tableColumns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE = "CAR_UPDATE_STATUS_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const CarUpdateStatusTable = ({ carupdateid, token }) => {
|
const CarUpdateStatusTable = ({ carupdateid, token }) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [log, setLog] = useState([]);
|
const [log, setLog] = useState([]);
|
||||||
const [logTotal, setLogTotal] = useState(0);
|
const [logTotal, setLogTotal] = useState(0);
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("id");
|
const [orderBy, setOrderBy] = useState("id");
|
||||||
const [order, setOrder] = useState("desc");
|
const [order, setOrder] = useState("desc");
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
import { useStatusContext } from "../../Contexts/StatusContext";
|
import { useStatusContext } from "../../Contexts/StatusContext";
|
||||||
import useStyles from "../../useStyles";
|
import useStyles from "../../useStyles";
|
||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -42,9 +43,11 @@ const tableColumns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE = "CAR_UPDATES_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const MainForm = ({ vin, token }) => {
|
const MainForm = ({ vin, token }) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("id");
|
const [orderBy, setOrderBy] = useState("id");
|
||||||
const [order, setOrder] = useState("desc");
|
const [order, setOrder] = useState("desc");
|
||||||
|
|||||||
@@ -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 () => {
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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(
|
||||||
@@ -14,6 +14,10 @@ const renderTabPanel = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
26
src/components/Dashboard/index.jsx
Normal file
26
src/components/Dashboard/index.jsx
Normal 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;
|
||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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(
|
||||||
@@ -28,6 +29,10 @@ const renderFleetCANFilterAdd = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import useStyles from "../../../../useStyles";
|
|||||||
import SearchField from "../../../../Controls/SearchField";
|
import SearchField from "../../../../Controls/SearchField";
|
||||||
import { logger } from "../../../../../services/monitoring";
|
import { logger } from "../../../../../services/monitoring";
|
||||||
import { Roles, hasRole } from "../../../../../utils/roles";
|
import { Roles, hasRole } from "../../../../../utils/roles";
|
||||||
|
import {useLocalStorage} from "../../../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -39,8 +40,10 @@ const tableColumns = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE = "FLEET_STATUS_CAN_FILTER_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const MainForm = ({ name }) => {
|
const MainForm = ({ name }) => {
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("id");
|
const [orderBy, setOrderBy] = useState("id");
|
||||||
const [order, setOrder] = useState("desc");
|
const [order, setOrder] = useState("desc");
|
||||||
|
|||||||
@@ -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(
|
||||||
@@ -31,6 +32,10 @@ const renderFleetCANFiltersTable = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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(
|
||||||
@@ -28,6 +29,10 @@ const renderFleetCANFilterUpdate = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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=""
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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,14 +12,15 @@ 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>
|
||||||
@@ -28,11 +29,17 @@ const renderDetailsTab = async () => {
|
|||||||
</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();
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import useStyles from "../../../../useStyles";
|
|||||||
import SearchField from "../../../../Controls/SearchField";
|
import SearchField from "../../../../Controls/SearchField";
|
||||||
import { logger } from "../../../../../services/monitoring";
|
import { logger } from "../../../../../services/monitoring";
|
||||||
import { Roles, hasRole } from "../../../../../utils/roles";
|
import { Roles, hasRole } from "../../../../../utils/roles";
|
||||||
|
import {useLocalStorage} from "../../../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -34,8 +35,10 @@ const tableColumns = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE = "FLEET_STATUS_VEHICLES_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const MainForm = ({ name }) => {
|
const MainForm = ({ name }) => {
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("id");
|
const [orderBy, setOrderBy] = useState("id");
|
||||||
const [order, setOrder] = useState("desc");
|
const [order, setOrder] = useState("desc");
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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=""
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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=""
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { FleetProvider, useFleetContext } from "../../Contexts/FleetContext"
|
|||||||
import useStyles from "../../useStyles";
|
import useStyles from "../../useStyles";
|
||||||
import SearchField from "../../Controls/SearchField";
|
import SearchField from "../../Controls/SearchField";
|
||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -49,8 +50,10 @@ const tableColumns = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE = "FLEET_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const MainForm = () => {
|
const MainForm = () => {
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("id");
|
const [orderBy, setOrderBy] = useState("id");
|
||||||
const [order, setOrder] = useState("desc");
|
const [order, setOrder] = useState("desc");
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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([]);
|
||||||
|
|||||||
@@ -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],
|
||||||
},
|
},
|
||||||
@@ -62,6 +61,11 @@ const menuData = [
|
|||||||
to: "/tools/certificates/add",
|
to: "/tools/certificates/add",
|
||||||
roles: [Roles.CERTIFICATES],
|
roles: [Roles.CERTIFICATES],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "SMS",
|
||||||
|
to: "/tools/sms/send",
|
||||||
|
roles: [Roles.CREATE],
|
||||||
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -253,6 +251,28 @@ exports[`SideMenu Authenticated 1`] = `
|
|||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
aria-disabled="false"
|
||||||
|
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||||
|
href="/tools/sms/send"
|
||||||
|
role="button"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="MuiListItemText-root"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||||
|
>
|
||||||
|
SMS
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="MuiTouchRipple-root"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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 () => {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import SearchField from "../../Controls/SearchField";
|
|||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
import ECUList from "../../Controls/ECUList";
|
import ECUList from "../../Controls/ECUList";
|
||||||
import { Roles, hasRole } from "../../../utils/roles";
|
import { Roles, hasRole } from "../../../utils/roles";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -56,9 +57,11 @@ const tableColumns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE="MANIFEST_LIST_PAGE_SIZE";
|
||||||
|
|
||||||
const MainForm = () => {
|
const MainForm = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("id");
|
const [orderBy, setOrderBy] = useState("id");
|
||||||
const [order, setOrder] = useState("asc");
|
const [order, setOrder] = useState("asc");
|
||||||
|
|||||||
@@ -27,11 +27,14 @@ import useStyles from "../../useStyles";
|
|||||||
import { LocalDateTimeString } from "../../../utils/dates";
|
import { LocalDateTimeString } from "../../../utils/dates";
|
||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
import ManifestDetails from "../Details";
|
import ManifestDetails from "../Details";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
|
const PAGE_SIZE="MANIFEST_STATUS_PAGE_SIZE";
|
||||||
|
|
||||||
const MainForm = () => {
|
const MainForm = () => {
|
||||||
const { manifest_id } = useParams();
|
const { manifest_id } = useParams();
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const { getManifests, manifests } = useManifestsContext();
|
const { getManifests, manifests } = useManifestsContext();
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -34,9 +34,10 @@ const SSOForm = React.lazy(() => import("../SSOForm"));
|
|||||||
const VehicleAddForm = React.lazy(() => import("../Cars/Add"));
|
const VehicleAddForm = React.lazy(() => import("../Cars/Add"));
|
||||||
const VehicleUpdateForm = React.lazy(() => import("../Cars/Update"));
|
const VehicleUpdateForm = React.lazy(() => import("../Cars/Update"));
|
||||||
const CertificateCreate = React.lazy(() => import("../Certificates/Add"));
|
const CertificateCreate = React.lazy(() => import("../Certificates/Add"));
|
||||||
|
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 (
|
||||||
@@ -208,6 +209,14 @@ const SiteRoutes = () => {
|
|||||||
groups={groups}
|
groups={groups}
|
||||||
roles={[Roles.CERTIFICATES]}
|
roles={[Roles.CERTIFICATES]}
|
||||||
/>
|
/>
|
||||||
|
<AuthRoute
|
||||||
|
path="/tools/sms/send"
|
||||||
|
render={() => <SMSSend />}
|
||||||
|
type={TYPES.PROTECTED}
|
||||||
|
token={token}
|
||||||
|
groups={groups}
|
||||||
|
roles={[Roles.CREATE]}
|
||||||
|
/>
|
||||||
<AuthRoute
|
<AuthRoute
|
||||||
path="/suppliers"
|
path="/suppliers"
|
||||||
render={() => <SuppliersList />}
|
render={() => <SuppliersList />}
|
||||||
@@ -224,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>
|
||||||
|
|||||||
92
src/components/SMS/Send/SendForm.jsx
Normal file
92
src/components/SMS/Send/SendForm.jsx
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import React, { useRef, useState } from "react";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
FormControlLabel,
|
||||||
|
Checkbox,
|
||||||
|
TextField,
|
||||||
|
} from "@material-ui/core";
|
||||||
|
|
||||||
|
import useStyles from "../../useStyles";
|
||||||
|
import { SMS } from "../../Contexts/SMSContext";
|
||||||
|
|
||||||
|
const SendForm = ({ onSend, busy }) => {
|
||||||
|
const classes = useStyles();
|
||||||
|
|
||||||
|
const iccidEl = useRef(null);
|
||||||
|
|
||||||
|
const [message, setMessage] = useState(null);
|
||||||
|
const [isAwaited, setAwait] = useState(false);
|
||||||
|
|
||||||
|
const onSubmit = async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (onSend) onSend(new SMS(message, iccidEl.current.value, isAwaited));
|
||||||
|
};
|
||||||
|
|
||||||
|
const onMessageChange = (event) => {
|
||||||
|
setMessage(event.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAwaitChange = (event) => {
|
||||||
|
setAwait(event.target.checked);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={classes.paper}>
|
||||||
|
<form className={classes.form} noValidate action="{onSubmit}">
|
||||||
|
<TextField
|
||||||
|
id="iccid"
|
||||||
|
name="iccid"
|
||||||
|
label="ICCID"
|
||||||
|
variant="outlined"
|
||||||
|
margin="normal"
|
||||||
|
inputProps={{
|
||||||
|
maxLength: "50",
|
||||||
|
minLength: "15",
|
||||||
|
}}
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
inputRef={iccidEl}
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
id="message"
|
||||||
|
name="message"
|
||||||
|
label="Message"
|
||||||
|
variant="outlined"
|
||||||
|
margin="normal"
|
||||||
|
inputProps={{
|
||||||
|
maxLength: "320",
|
||||||
|
}}
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
onChange={onMessageChange}
|
||||||
|
/>
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={isAwaited}
|
||||||
|
onChange={onAwaitChange}
|
||||||
|
value="isAwaited"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label="Await delivery"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
disabled={busy}
|
||||||
|
fullWidth
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
className={classes.submit}
|
||||||
|
onClick={onSubmit}
|
||||||
|
>
|
||||||
|
{busy ? "Sending..." : "Send"}
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SendForm;
|
||||||
39
src/components/SMS/Send/ViewResult.jsx
Normal file
39
src/components/SMS/Send/ViewResult.jsx
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import { Button } from "@material-ui/core";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import useStyles from "../../useStyles";
|
||||||
|
|
||||||
|
const ViewResult = ({ result, onChangeView }) => {
|
||||||
|
const classes = useStyles();
|
||||||
|
|
||||||
|
const onNewSMS = (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
if (!onChangeView) return;
|
||||||
|
onChangeView();
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h2>View Result</h2>
|
||||||
|
<ul>
|
||||||
|
{Object.keys(result).map((key) => (
|
||||||
|
<li key={key}>
|
||||||
|
{key}:{result[key]}
|
||||||
|
<br />
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
fullWidth
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
className={classes.submit}
|
||||||
|
onClick={onNewSMS}
|
||||||
|
>
|
||||||
|
Done
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ViewResult;
|
||||||
23
src/components/SMS/Send/ViewResult.test.jsx
Normal file
23
src/components/SMS/Send/ViewResult.test.jsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { render, waitFor } from "@testing-library/react";
|
||||||
|
|
||||||
|
import ViewResult from "./ViewResult";
|
||||||
|
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||||
|
|
||||||
|
describe("ViewResult", () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
global.URL.createObjectURL = jest.fn();
|
||||||
|
global.URL.revokeObjectURL = jest.fn();
|
||||||
|
addSnapshotSerializer(expect);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Render", async () => {
|
||||||
|
const { container } = render(
|
||||||
|
<ViewResult result={{ result: "success", message: "message" }} />
|
||||||
|
);
|
||||||
|
await waitFor(() => {
|
||||||
|
/* render */
|
||||||
|
});
|
||||||
|
expect(container).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`ViewResult Render 1`] = `
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<h2>
|
||||||
|
View Result
|
||||||
|
</h2>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
result
|
||||||
|
:
|
||||||
|
success
|
||||||
|
<br />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
message
|
||||||
|
:
|
||||||
|
message
|
||||||
|
<br />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<button
|
||||||
|
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"
|
||||||
|
tabindex="0"
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiButton-label"
|
||||||
|
>
|
||||||
|
Done
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="MuiTouchRipple-root"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
68
src/components/SMS/Send/index.jsx
Normal file
68
src/components/SMS/Send/index.jsx
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
import { useSMSContext, SMSProvider } from "../../Contexts/SMSContext";
|
||||||
|
import { useStatusContext } from "../../Contexts/StatusContext";
|
||||||
|
import { useUserContext } from "../../Contexts/UserContext";
|
||||||
|
import { logger } from "../../../services/monitoring";
|
||||||
|
import SendForm from "./SendForm";
|
||||||
|
import ViewResult from "./ViewResult";
|
||||||
|
|
||||||
|
const VIEW_FORM = 0;
|
||||||
|
const VIEW_RESULT = 1;
|
||||||
|
|
||||||
|
const MainForm = () => {
|
||||||
|
const { busy, sendSMS } = useSMSContext();
|
||||||
|
const { setMessage, setTitle, setSitePath } = useStatusContext();
|
||||||
|
const {
|
||||||
|
token: {
|
||||||
|
idToken: { jwtToken: token },
|
||||||
|
},
|
||||||
|
} = useUserContext();
|
||||||
|
const [view, setView] = useState(VIEW_FORM);
|
||||||
|
const [result, setResult] = useState(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTitle("Send SMS");
|
||||||
|
setSitePath([
|
||||||
|
{
|
||||||
|
label: "Tools",
|
||||||
|
link: "/tools/sms/send",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Send SMS",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const onSend = async (data) => {
|
||||||
|
try {
|
||||||
|
setResult(await sendSMS(data, token));
|
||||||
|
|
||||||
|
setMessage(`Sent ${data.messageText} to ${data.ICCID}`);
|
||||||
|
setView(VIEW_RESULT);
|
||||||
|
} catch (e) {
|
||||||
|
setMessage(e.message);
|
||||||
|
logger.warn(e.stack);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChangeView = () => {
|
||||||
|
setResult(null);
|
||||||
|
|
||||||
|
setView(VIEW_FORM);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (view === VIEW_RESULT)
|
||||||
|
return <ViewResult result={result} onChangeView={onChangeView} />;
|
||||||
|
|
||||||
|
return <SendForm onSend={onSend} busy={busy} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const SMSSend = () => (
|
||||||
|
<SMSProvider>
|
||||||
|
<MainForm />
|
||||||
|
</SMSProvider>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default SMSSend;
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { useStatusContext } from "../../Contexts/StatusContext";
|
|||||||
import { LocalDateTimeString } from "../../../utils/dates";
|
import { LocalDateTimeString } from "../../../utils/dates";
|
||||||
import TableHeaderSortable from "../../Table/HeaderSortable";
|
import TableHeaderSortable from "../../Table/HeaderSortable";
|
||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
|
import {useLocalStorage} from "../../useLocalStorage";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
{
|
||||||
@@ -48,9 +49,11 @@ const tableColumns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PAGE_SIZE="SUPPLIER_TABLE_PAGE_SIZE";
|
||||||
|
|
||||||
const SupplierTable = (props) => {
|
const SupplierTable = (props) => {
|
||||||
const { token, classes } = props;
|
const { token, classes } = props;
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [orderBy, setOrderBy] = useState("created_at");
|
const [orderBy, setOrderBy] = useState("created_at");
|
||||||
const [order, setOrder] = useState("asc");
|
const [order, setOrder] = useState("asc");
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user