Merge branch 'release/0.0.3'
This commit is contained in:
@@ -8,7 +8,7 @@ import { BrowserRouter } from "react-router-dom";
|
||||
import { FleetProvider } from "../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("FleetAddForm", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetAdd();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ import { BrowserRouter } from "react-router-dom";
|
||||
import { FleetProvider } from "../../../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER }from "../../../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../../../utils/snapshot";
|
||||
|
||||
@@ -34,7 +34,7 @@ describe("FleetCANFilterAdd", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetCANFilterAdd();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -221,23 +221,6 @@ exports[`FleetCANFiltersTable Render 1`] = `
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"123-456\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete 123-456"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -277,23 +260,6 @@ exports[`FleetCANFiltersTable Render 1`] = `
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"1\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete 1"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -333,23 +299,6 @@ exports[`FleetCANFiltersTable Render 1`] = `
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"1000\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete 1000"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link } from 'react-router-dom';
|
||||
import {
|
||||
Grid,
|
||||
Table,
|
||||
@@ -12,37 +10,42 @@ import {
|
||||
} from "@material-ui/core";
|
||||
import AddCircleIcon from "@material-ui/icons/AddCircle";
|
||||
import DeleteIcon from "@material-ui/icons/Delete";
|
||||
import EditIcon from '@material-ui/icons/Edit';
|
||||
import EditIcon from "@material-ui/icons/Edit";
|
||||
import clsx from "clsx";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import TableHeaderSortable from "../../../../Table/HeaderSortable";
|
||||
import { useUserContext } from "../../../../Contexts/UserContext"
|
||||
import { useStatusContext } from "../../../../Contexts/StatusContext";
|
||||
import { FleetProvider, useFleetContext } from "../../../../Contexts/FleetContext"
|
||||
import useStyles from "../../../../useStyles";
|
||||
import SearchField from "../../../../Controls/SearchField";
|
||||
import { logger } from "../../../../../services/monitoring";
|
||||
import { Roles, hasRole } from "../../../../../utils/roles";
|
||||
import {useLocalStorage} from "../../../../useLocalStorage";
|
||||
import {trimIfMoreThan} from "../../../../../utils/strings"
|
||||
import { hasRole, Permissions } from "../../../../../utils/roles";
|
||||
import { trimIfMoreThan } from "../../../../../utils/strings";
|
||||
import {
|
||||
FleetProvider,
|
||||
useFleetContext,
|
||||
} from "../../../../Contexts/FleetContext";
|
||||
import { useStatusContext } from "../../../../Contexts/StatusContext";
|
||||
import { useUserContext } from "../../../../Contexts/UserContext";
|
||||
import SearchField from "../../../../Controls/SearchField";
|
||||
import TableHeaderSortable from "../../../../Table/HeaderSortable";
|
||||
import { useLocalStorage } from "../../../../useLocalStorage";
|
||||
import useStyles from "../../../../useStyles";
|
||||
|
||||
const tableColumns = [
|
||||
{
|
||||
id: "can_id",
|
||||
label: "CAN ID"
|
||||
label: "CAN ID",
|
||||
},
|
||||
{
|
||||
id: "interval",
|
||||
label: "Interval (ms)"
|
||||
label: "Interval (ms)",
|
||||
},
|
||||
{
|
||||
id: "edge_mask",
|
||||
label: "Edge mask"
|
||||
label: "Edge mask",
|
||||
},
|
||||
{
|
||||
id: "",
|
||||
label: "Actions"
|
||||
}
|
||||
label: "Actions",
|
||||
},
|
||||
];
|
||||
|
||||
const PAGE_SIZE = "FLEET_STATUS_CAN_FILTER_TABLE_PAGE_SIZE";
|
||||
@@ -54,8 +57,19 @@ const MainForm = ({ name }) => {
|
||||
const [order, setOrder] = useState("desc");
|
||||
const classes = useStyles();
|
||||
const { setMessage } = useStatusContext();
|
||||
const { fleetCANFilters, totalFleetCANFilters, getFleetCANFilters, deleteFleetCANFilter } = useFleetContext();
|
||||
const { token: { idToken: { jwtToken: token } }, groups } = useUserContext();
|
||||
const {
|
||||
fleetCANFilters,
|
||||
totalFleetCANFilters,
|
||||
getFleetCANFilters,
|
||||
deleteFleetCANFilter,
|
||||
} = useFleetContext();
|
||||
const {
|
||||
token: {
|
||||
idToken: { jwtToken: token },
|
||||
},
|
||||
groups,
|
||||
providers,
|
||||
} = useUserContext();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
@@ -107,7 +121,7 @@ const MainForm = ({ name }) => {
|
||||
const onDelete = async (can_id) => {
|
||||
try {
|
||||
await deleteFleetCANFilter(name, can_id, token);
|
||||
setMessage(`Deleted ${can_id}`)
|
||||
setMessage(`Deleted ${can_id}`);
|
||||
} catch (e) {
|
||||
setMessage(e.message);
|
||||
logger.warn(e.stack);
|
||||
@@ -116,19 +130,19 @@ const MainForm = ({ name }) => {
|
||||
|
||||
const Actions = (row) => {
|
||||
let actions = [];
|
||||
if (hasRole([Roles.CREATE], groups)) {
|
||||
if (hasRole(groups, Permissions.FiskerCreate, providers)) {
|
||||
actions.push({
|
||||
tip: `Update "${row.can_id}"`,
|
||||
link: `/fleet/${name}/filter-update?name=${name}&can_id=${row.can_id}&interval=${row.interval}`,
|
||||
icon: <EditIcon aria-label={`Update ${row.can_id}`} />
|
||||
icon: <EditIcon aria-label={`Update ${row.can_id}`} />,
|
||||
});
|
||||
}
|
||||
if (hasRole([Roles.DELETE], groups)) {
|
||||
if (hasRole(groups, Permissions.FiskerDelete, providers)) {
|
||||
actions.push({
|
||||
tip: `Delete "${row.can_id}"`,
|
||||
id: row.can_id,
|
||||
icon: <DeleteIcon aria-label={`Delete ${row.can_id}`} />
|
||||
})
|
||||
icon: <DeleteIcon aria-label={`Delete ${row.can_id}`} />,
|
||||
});
|
||||
}
|
||||
if (actions.length === 0) return ["No actions"];
|
||||
|
||||
@@ -157,7 +171,10 @@ const MainForm = ({ name }) => {
|
||||
<div className={clsx(classes.paper, classes.tableSize)}>
|
||||
<Grid container className={classes.root} spacing={2}>
|
||||
<Grid item md={4} className={classes.textJustifyAlign}>
|
||||
<Link to={`/fleet/${name}/filter-add`} className={classes.labelInline}>
|
||||
<Link
|
||||
to={`/fleet/${name}/filter-add`}
|
||||
className={classes.labelInline}
|
||||
>
|
||||
<AddCircleIcon fontSize="large" />
|
||||
</Link>
|
||||
</Grid>
|
||||
@@ -174,11 +191,13 @@ const MainForm = ({ name }) => {
|
||||
onSortRequest={handleSort}
|
||||
/>
|
||||
<TableBody>
|
||||
{fleetCANFilters.map(row => (
|
||||
{fleetCANFilters.map((row) => (
|
||||
<TableRow key={row.can_id}>
|
||||
<TableCell align="center">{row.can_id}</TableCell>
|
||||
<TableCell align="center">{row.interval}</TableCell>
|
||||
<TableCell align="center">{trimIfMoreThan(row.edge_mask, 15, "...")}</TableCell>
|
||||
<TableCell align="center">
|
||||
{trimIfMoreThan(row.edge_mask, 15, "...")}
|
||||
</TableCell>
|
||||
<TableCell align="center">{Actions(row)}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
@@ -201,7 +220,7 @@ const MainForm = ({ name }) => {
|
||||
</TableRow>
|
||||
</TableFooter>
|
||||
</Table>
|
||||
</div >
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { BrowserRouter } from "react-router-dom";
|
||||
import { FleetProvider } from "../../../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER }from "../../../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../../../utils/snapshot";
|
||||
|
||||
@@ -37,7 +37,7 @@ describe("FleetCANFiltersTable", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetCANFiltersTable();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ import { BrowserRouter } from "react-router-dom";
|
||||
import { FleetProvider } from "../../../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../../../utils/snapshot";
|
||||
|
||||
@@ -34,7 +34,7 @@ describe("FleetCANFilterUpdate", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetCANFilterUpdate();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import { render, waitFor } from "@testing-library/react";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
|
||||
import { setToken } from "../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
|
||||
import CANFiltersTab from "./CANFiltersTab";
|
||||
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("CANFiltersTab", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderCANFitlersTab();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import routeData from "react-router";
|
||||
import { FleetProvider } from "../../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER }from "../../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../../utils/snapshot";
|
||||
|
||||
@@ -42,7 +42,7 @@ describe("FleetDetailsTab", () => {
|
||||
})
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetDetailsTab();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import { MemoryRouter, Route } from "react-router-dom";
|
||||
import { FleetProvider } from "../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
|
||||
import MainForm from "./DetailsTab";
|
||||
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||
|
||||
@@ -41,7 +41,7 @@ describe("DetailsTab", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderDetailsTab();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ import { BrowserRouter } from "react-router-dom";
|
||||
import { FleetProvider } from "../../../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER }from "../../../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../../../utils/snapshot";
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("FleetVehicleAdd", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetVehicleAdd();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -153,26 +153,7 @@ exports[`FleetVehiclesTable Render 1`] = `
|
||||
<td
|
||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||
>
|
||||
<span>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"USWESTVIN12345678\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete USWESTVIN12345678"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<div />
|
||||
</span>
|
||||
No actions
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -190,26 +171,7 @@ exports[`FleetVehiclesTable Render 1`] = `
|
||||
<td
|
||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||
>
|
||||
<span>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"USWESTVIN12345679\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete USWESTVIN12345679"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<div />
|
||||
</span>
|
||||
No actions
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -227,26 +189,7 @@ exports[`FleetVehiclesTable Render 1`] = `
|
||||
<td
|
||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||
>
|
||||
<span>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"USWESTVIN12345670\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete USWESTVIN12345670"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<div />
|
||||
</span>
|
||||
No actions
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import {
|
||||
Grid,
|
||||
Table,
|
||||
@@ -8,25 +6,27 @@ import {
|
||||
TableFooter,
|
||||
TablePagination,
|
||||
TableRow,
|
||||
Tooltip,
|
||||
Tooltip
|
||||
} from "@material-ui/core";
|
||||
import AddCircleIcon from "@material-ui/icons/AddCircle";
|
||||
import DeleteIcon from "@material-ui/icons/Delete";
|
||||
import clsx from "clsx";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import TableHeaderSortable from "../../../../Table/HeaderSortable";
|
||||
import { useUserContext } from "../../../../Contexts/UserContext";
|
||||
import { useStatusContext } from "../../../../Contexts/StatusContext";
|
||||
import { logger } from "../../../../../services/monitoring";
|
||||
import { hasRole, Permissions } from "../../../../../utils/roles";
|
||||
import {
|
||||
FleetProvider,
|
||||
useFleetContext,
|
||||
useFleetContext
|
||||
} from "../../../../Contexts/FleetContext";
|
||||
import useStyles from "../../../../useStyles";
|
||||
import { useStatusContext } from "../../../../Contexts/StatusContext";
|
||||
import { useUserContext } from "../../../../Contexts/UserContext";
|
||||
import SearchField from "../../../../Controls/SearchField";
|
||||
import { logger } from "../../../../../services/monitoring";
|
||||
import { Roles, hasRole } from "../../../../../utils/roles";
|
||||
import { useLocalStorage } from "../../../../useLocalStorage";
|
||||
import DeleteConfirmation from "../../../../DeleteConfirmation";
|
||||
import TableHeaderSortable from "../../../../Table/HeaderSortable";
|
||||
import { useLocalStorage } from "../../../../useLocalStorage";
|
||||
import useStyles from "../../../../useStyles";
|
||||
|
||||
const tableColumns = [
|
||||
{
|
||||
@@ -61,6 +61,7 @@ const MainForm = ({ name }) => {
|
||||
idToken: { jwtToken: token },
|
||||
},
|
||||
groups,
|
||||
providers,
|
||||
} = useUserContext();
|
||||
|
||||
const handleSearch = (query) => {
|
||||
@@ -127,7 +128,7 @@ const MainForm = ({ name }) => {
|
||||
|
||||
const Actions = (vin) => {
|
||||
let actions = [];
|
||||
if (hasRole([Roles.DELETE], groups)) {
|
||||
if (hasRole(groups, Permissions.FiskerDelete, providers)) {
|
||||
actions.push({
|
||||
tip: `Delete "${vin}"`,
|
||||
id: vin,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { BrowserRouter } from "react-router-dom";
|
||||
import { FleetProvider } from "../../../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER }from "../../../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../../../utils/snapshot";
|
||||
|
||||
@@ -39,7 +39,7 @@ describe("FleetVehiclesTable", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetVehiclesTable();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import { render, waitFor } from "@testing-library/react";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
|
||||
import { setToken } from "../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
|
||||
import VehiclesTab from "./VehiclesTab";
|
||||
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("VehiclesTab", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderVehiclesTab();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -220,23 +220,6 @@ exports[`CANFiltersTab Render 1`] = `
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"123-456\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete 123-456"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -276,23 +259,6 @@ exports[`CANFiltersTab Render 1`] = `
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"1\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete 1"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -332,23 +298,6 @@ exports[`CANFiltersTab Render 1`] = `
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"1000\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete 1000"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -152,26 +152,7 @@ exports[`VehiclesTab Render 1`] = `
|
||||
<td
|
||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||
>
|
||||
<span>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"USWESTVIN12345678\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete USWESTVIN12345678"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<div />
|
||||
</span>
|
||||
No actions
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -189,26 +170,7 @@ exports[`VehiclesTab Render 1`] = `
|
||||
<td
|
||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||
>
|
||||
<span>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"USWESTVIN12345679\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete USWESTVIN12345679"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<div />
|
||||
</span>
|
||||
No actions
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -226,26 +188,7 @@ exports[`VehiclesTab Render 1`] = `
|
||||
<td
|
||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||
>
|
||||
<span>
|
||||
<a
|
||||
class=""
|
||||
href="/"
|
||||
title="Delete \\"USWESTVIN12345670\\""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
aria-label="Delete USWESTVIN12345670"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<div />
|
||||
</span>
|
||||
No actions
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -12,7 +12,7 @@ import routeData from "react-router";
|
||||
import { FleetProvider } from "../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
|
||||
import FleetStatus from "./index";
|
||||
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||
|
||||
@@ -45,7 +45,7 @@ describe("FleetStatus", () => {
|
||||
})
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderCarStatus();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import { BrowserRouter } from "react-router-dom";
|
||||
import { FleetProvider } from "../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||
|
||||
@@ -39,7 +39,7 @@ describe("FleetTable", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetTable();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ import { BrowserRouter } from "react-router-dom";
|
||||
import { FleetProvider } from "../../Contexts/FleetContext";
|
||||
import { StatusProvider } from "../../Contexts/StatusContext";
|
||||
import { UserProvider, setToken } from "../../Contexts/UserContext";
|
||||
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
|
||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
|
||||
import MainForm from "./index";
|
||||
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("FleetUpdate", () => {
|
||||
});
|
||||
|
||||
it("Render", async () => {
|
||||
setToken(TEST_AUTH_OBJECT);
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
const container = await renderFleetUpdate();
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user