commit
13b3971daf
|
@ -1,10 +1,5 @@
|
|||
const mockDevice = { setUserEnv: jest.fn(() => Promise.resolve({})) };
|
||||
|
||||
jest.mock("../../../device", () => ({
|
||||
getDevice: () => {
|
||||
return mockDevice;
|
||||
}
|
||||
}));
|
||||
jest.mock("../../../device", () => ({ getDevice: () => mockDevice }));
|
||||
|
||||
jest.mock("../actions", () => ({ scanImage: jest.fn() }));
|
||||
jest.mock("../../images/actions", () => ({ selectImage: jest.fn() }));
|
||||
|
@ -90,4 +85,14 @@ describe("<CameraCalibration/>", () => {
|
|||
expect(p.saveFarmwareEnv)
|
||||
.toHaveBeenCalledWith("CAMERA_CALIBRATION_camera_offset_x", "10");
|
||||
});
|
||||
|
||||
it("saves string WeedDetectorConfig changes: API", () => {
|
||||
const p = fakeProps();
|
||||
p.shouldDisplay = () => true;
|
||||
const wrapper = shallow(<CameraCalibration {...p} />);
|
||||
wrapper.find("WeedDetectorConfig")
|
||||
.simulate("change", "CAMERA_CALIBRATION_image_bot_origin_location", 4);
|
||||
expect(p.saveFarmwareEnv).toHaveBeenCalledWith(
|
||||
"CAMERA_CALIBRATION_image_bot_origin_location", "\"BOTTOM_LEFT\"");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,6 +12,7 @@ import { WeedDetectorConfig } from "../weed_detector/config";
|
|||
import { Feature } from "../../devices/interfaces";
|
||||
import { namespace } from "../weed_detector";
|
||||
import { t } from "../../i18next_wrapper";
|
||||
import { formatEnvKey } from "../weed_detector/remote_env/translators";
|
||||
|
||||
export class CameraCalibration extends
|
||||
React.Component<CameraCalibrationProps, {}> {
|
||||
|
@ -23,7 +24,8 @@ export class CameraCalibration extends
|
|||
|
||||
saveEnvVar = (key: WDENVKey, value: number) =>
|
||||
this.props.shouldDisplay(Feature.api_farmware_env)
|
||||
? this.props.dispatch(this.props.saveFarmwareEnv(key, "" + value))
|
||||
? this.props.dispatch(this.props.saveFarmwareEnv(
|
||||
key, JSON.stringify(formatEnvKey(key, value))))
|
||||
: envSave(key, value)
|
||||
|
||||
render() {
|
||||
|
|
Loading…
Reference in New Issue