Merge branch 'main' into CEC-3796
This commit is contained in:
@@ -49,7 +49,7 @@ export default forwardRef(({
|
|||||||
const [ecus, setECUs] = useState([{ ecu: "TBOX" }]);
|
const [ecus, setECUs] = useState([{ ecu: "TBOX" }]);
|
||||||
const [currentECU, setCurrentECU] = useState("");
|
const [currentECU, setCurrentECU] = useState("");
|
||||||
const [validateECUs, setValidateECUs] = useState(false);
|
const [validateECUs, setValidateECUs] = useState(false);
|
||||||
const [command, setCommand] = useState("");
|
const [command, setCommand] = useState(commands[0].val);
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { setMessage } = useStatusContext();
|
const { setMessage } = useStatusContext();
|
||||||
const { token: { idToken: { jwtToken: token } } } = useUserContext();
|
const { token: { idToken: { jwtToken: token } } } = useUserContext();
|
||||||
@@ -88,6 +88,7 @@ export default forwardRef(({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValidateECUs(true);
|
setValidateECUs(true);
|
||||||
|
setCurrentECU(ecus[0].ecu);
|
||||||
}, [ecus]);
|
}, [ecus]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
} from "@testing-library/react";
|
} from "@testing-library/react";
|
||||||
import { UserProvider, setToken } from "../../Contexts/UserContext";
|
import { UserProvider, setToken } from "../../Contexts/UserContext";
|
||||||
import { StatusProvider } from "../../Contexts/StatusContext";
|
import { StatusProvider } from "../../Contexts/StatusContext";
|
||||||
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
|
import { TEST_AUTH_OBJECT_FISKER, TEST_TOKEN_FISKER } from "../../../utils/testing";
|
||||||
import Diagnostic from "./Diagnostic";
|
import Diagnostic from "./Diagnostic";
|
||||||
import vehiclesAPI from "../../../services/vehiclesAPI";
|
import vehiclesAPI from "../../../services/vehiclesAPI";
|
||||||
|
|
||||||
@@ -23,12 +23,14 @@ describe("BulkActions/DeleteVehicles", () => {
|
|||||||
const getECUs = jest.spyOn(vehiclesAPI, "getECUs");
|
const getECUs = jest.spyOn(vehiclesAPI, "getECUs");
|
||||||
const ref = React.createRef();
|
const ref = React.createRef();
|
||||||
|
|
||||||
|
const vins = ["TESTVIN123456789a", "TESTVIN123456789b", "TESTVIN123456789c"];
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<StatusProvider>
|
<StatusProvider>
|
||||||
<UserProvider>
|
<UserProvider>
|
||||||
<Diagnostic
|
<Diagnostic
|
||||||
ref={ref}
|
ref={ref}
|
||||||
ids={["TESTVIN123456789a", "TESTVIN123456789b", "TESTVIN123456789c"]}
|
ids={vins}
|
||||||
idCSV=""
|
idCSV=""
|
||||||
/>
|
/>
|
||||||
</UserProvider>
|
</UserProvider>
|
||||||
@@ -37,6 +39,10 @@ describe("BulkActions/DeleteVehicles", () => {
|
|||||||
|
|
||||||
await act(async () => ref.current.submit());
|
await act(async () => ref.current.submit());
|
||||||
expect(sendDiagnosticCommand).toHaveBeenCalledTimes(1);
|
expect(sendDiagnosticCommand).toHaveBeenCalledTimes(1);
|
||||||
|
expect(sendDiagnosticCommand).toHaveBeenCalledWith(vins, {
|
||||||
|
command: "remote_reset",
|
||||||
|
ecu_name: "TBOX",
|
||||||
|
}, TEST_TOKEN_FISKER);
|
||||||
expect(getECUs).toHaveBeenCalledTimes(3);
|
expect(getECUs).toHaveBeenCalledTimes(3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user