Type errors fixed

This commit is contained in:
Rick Carlino 2018-07-02 16:43:51 -05:00
parent fdc504b4b9
commit 7299345074
132 changed files with 384 additions and 384 deletions

View file

@ -31,7 +31,7 @@ describe("<ControlsPopup />", () => {
const p = fakeProps();
p.axisInversion.x = true;
const wrapper =mount<>(<ControlsPopup {...p} />);
const wrapper = mount<ControlsPopup>(<ControlsPopup {...p} />);
it("Has a false initial state", () => {
expect(wrapper.state("isOpen")).toBeFalsy();
@ -68,7 +68,7 @@ describe("<ControlsPopup />", () => {
it("swaps axes", () => {
const swappedProps = fakeProps();
swappedProps.xySwap = true;
const swapped =mount<>(<ControlsPopup {...swappedProps} />);
const swapped = mount<ControlsPopup>(<ControlsPopup {...swappedProps} />);
swapped.setState({ isOpen: true });
expect(swapped.state("isOpen")).toBeTruthy();
const button = swapped.find("button").at(1);

View file

@ -22,7 +22,7 @@ describe("<CrashPage/>", () => {
message: "@@@ERROR@@@"
};
const CrashPage = crashPage(fakeError);
const el =mount<>(<CrashPage />);
const el = mount<typeof CrashPage>(<CrashPage />);
const html = el.html();
expect(html).toContain(fakeError.message);
expect(html).toContain(fakeError.stack[0]);

View file

@ -4,7 +4,7 @@ import { FourOhFour } from "../404";
describe("<FourOhFour/>", function () {
it("renders helpful text", function () {
const dom =mount<>(<FourOhFour />);
const dom = mount<FourOhFour>(<FourOhFour />);
expect(dom.html()).toContain("Page Not Found");
});
});

View file

@ -5,7 +5,7 @@ import { mount } from "enzyme";
describe("<DeleteAccount/>", () => {
it("executes account deletion", () => {
const fn = jest.fn();
const el =mount<>(<DeleteAccount onClick={fn} />);
const el = mount<DeleteAccount>(<DeleteAccount onClick={fn} />);
el.setState({ password: "123" });
el.find("button.red").last().simulate("click");
expect(fn).toHaveBeenCalledTimes(1);

View file

@ -16,7 +16,7 @@ describe("<Account />", () => {
const props = mapStateToProps(fakeState());
props.dispatch = jest.fn();
const el =mount<>(<Account {...props} />);
const el = mount<Account>(<Account {...props} />);
expect(() => {
(el.instance() as Account).onChange({
currentTarget: {
@ -39,7 +39,7 @@ describe("<Account />", () => {
it("triggers the onSave() event", () => {
const props = mapStateToProps(fakeState());
props.dispatch = jest.fn(() => Promise.resolve({}));
const el =mount<>(<Account {...props} />);
const el = mount<Account>(<Account {...props} />);
(el.instance() as Account).onSave();
expect(props.dispatch).toHaveBeenCalledTimes(1);

View file

@ -11,7 +11,7 @@ describe("<Settings/>", function () {
onChange: jest.fn(),
onSave: jest.fn()
};
const dom =mount<>(<Settings {...props} />);
const dom = mount<Settings>(<Settings {...props} />);
expect(props.onSave).not.toHaveBeenCalled();
dom.find("button").simulate("click");
expect(props.onSave).toHaveBeenCalled();

View file

@ -21,7 +21,7 @@ import { LabsFeatures } from "../labs_features";
describe("<LabsFeatures/>", () => {
it("triggers the correct callback on click", () => {
const el =mount<>(<LabsFeatures />);
const el = mount<LabsFeatures>(<LabsFeatures />);
expect(mocks.fetchLabFeatures.mock.calls.length).toBeGreaterThan(0);
el.find("button").simulate("click");
expect(mockFeatures[0].callback).toHaveBeenCalled();

View file

@ -17,7 +17,7 @@ describe("<AxisInputBoxGroup />", () => {
};
it("has 3 inputs and a button", () => {
const wrapper =mount<>(<AxisInputBoxGroup {...props} />);
const wrapper = mount<AxisInputBoxGroup>(<AxisInputBoxGroup {...props} />);
expect(wrapper.find("input").length).toEqual(3);
expect(wrapper.find("button").length).toEqual(1);
@ -25,13 +25,13 @@ describe("<AxisInputBoxGroup />", () => {
it("button is disabled", () => {
props.disabled = true;
const wrapper =mount<>(<AxisInputBoxGroup {...props} />);
const wrapper = mount<AxisInputBoxGroup>(<AxisInputBoxGroup {...props} />);
wrapper.find("button").simulate("click");
expect(props.onCommit).not.toHaveBeenCalled();
});
it("changes", () => {
const wrapper =mount<>(<AxisInputBoxGroup {...props} />);
const wrapper = mount<AxisInputBoxGroup>(<AxisInputBoxGroup {...props} />);
// tslint:disable-next-line:no-any
const instance = wrapper.instance() as any;
instance.change("x", 10);
@ -44,7 +44,7 @@ describe("<AxisInputBoxGroup />", () => {
it(`Go: ${testCase}`, () => {
props.disabled = false;
props.position = coordinates.position;
const wrapper =mount<>(<AxisInputBoxGroup {...props} />);
const wrapper = mount<AxisInputBoxGroup>(<AxisInputBoxGroup {...props} />);
wrapper.setState(coordinates.inputs);
clickButton(wrapper, 0, "go");
expect(props.onCommit).toHaveBeenCalledWith(coordinates.expected);

View file

@ -7,7 +7,7 @@ describe("<AxisInputBox/>", () => {
function inputBoxWithValue(value: number | undefined) {
const axis: Xyz = "x";
const props = { axis, value, onChange: jest.fn() };
returnmount<>(<AxisInputBox {...props } />);
return mount(<AxisInputBox {...props} />);
}
it("renders 0 if 0", () => {

View file

@ -32,7 +32,7 @@ describe("<Controls />", () => {
it("shows webcam widget", () => {
mockConfig.hide_webcam_widget = false;
const wrapper =mount<>(<Controls {...fakeProps()} />);
const wrapper = mount<Controls>(<Controls {...fakeProps()} />);
const txt = wrapper.text().toLowerCase();
["webcam", "move", "peripherals", "sensors"]
.map(string => expect(txt).toContain(string));
@ -40,7 +40,7 @@ describe("<Controls />", () => {
it("hides webcam widget", () => {
mockConfig.hide_webcam_widget = true;
const wrapper =mount<>(<Controls {...fakeProps()} />);
const wrapper = mount<Controls>(<Controls {...fakeProps()} />);
const txt = wrapper.text().toLowerCase();
["move", "peripherals", "sensors"]
.map(string => expect(txt).toContain(string));
@ -50,7 +50,7 @@ describe("<Controls />", () => {
it("doesn't show sensors", () => {
const p = fakeProps();
p.shouldDisplay = () => false;
const wrapper =mount<>(<Controls {...p} />);
const wrapper = mount<Controls>(<Controls {...p} />);
const txt = wrapper.text().toLowerCase();
expect(txt).not.toContain("sensors");
});

View file

@ -39,20 +39,20 @@ describe("<DirectionButton/>", function () {
});
it("calls move command", () => {
const btn =mount<>(<DirectionButton {...buttonProps} />);
const btn = mount<DirectionButton>(<DirectionButton {...buttonProps} />);
btn.simulate("click");
expect(mockDevice.moveRelative).toHaveBeenCalledTimes(1);
});
it("is disabled", () => {
buttonProps.disabled = true;
const btn =mount<>(<DirectionButton {...buttonProps} />);
const btn = mount<DirectionButton>(<DirectionButton {...buttonProps} />);
btn.simulate("click");
expect(mockDevice.moveRelative).not.toHaveBeenCalled();
});
it("call has correct args", () => {
const btn =mount<>(<DirectionButton {...buttonProps} />);
const btn = mount<DirectionButton>(<DirectionButton {...buttonProps} />);
btn.simulate("click");
expect(mockDevice.moveRelative)
.toHaveBeenCalledWith({ speed: 100, x: 0, y: 1000, z: 0 });

View file

@ -35,7 +35,7 @@ describe("<JogButtons/>", function () {
};
it("calls home command", () => {
const jogButtons =mount<>(<JogButtons {...jogButtonProps()} />);
const jogButtons = mount(<JogButtons {...jogButtonProps()} />);
jogButtons.find("button").at(3).simulate("click");
expect(mockDevice.home).toHaveBeenCalledTimes(1);
});
@ -43,7 +43,7 @@ describe("<JogButtons/>", function () {
it("calls find home command", () => {
const p = jogButtonProps();
p.doFindHome = true;
const jogButtons =mount<>(<JogButtons {...p} />);
const jogButtons = mount(<JogButtons {...p} />);
jogButtons.find("button").at(3).simulate("click");
expect(mockDevice.findHome).toHaveBeenCalledTimes(1);
});
@ -51,26 +51,26 @@ describe("<JogButtons/>", function () {
it("is disabled", () => {
const p = jogButtonProps();
p.arduinoBusy = true;
const jogButtons =mount<>(<JogButtons {...p} />);
const jogButtons = mount(<JogButtons {...p} />);
jogButtons.find("button").at(3).simulate("click");
expect(mockDevice.home).not.toHaveBeenCalled();
});
it("call has correct args", () => {
const jogButtons =mount<>(<JogButtons {...jogButtonProps()} />);
const jogButtons = mount(<JogButtons {...jogButtonProps()} />);
jogButtons.find("button").at(3).simulate("click");
expect(mockDevice.home)
.toHaveBeenCalledWith({ axis: "all", speed: 100 });
});
it("takes photo", () => {
const jogButtons =mount<>(<JogButtons {...jogButtonProps()} />);
const jogButtons = mount(<JogButtons {...jogButtonProps()} />);
jogButtons.find("button").at(0).simulate("click");
expect(mockDevice.takePhoto).toHaveBeenCalled();
});
it("has unswapped xy jog buttons", () => {
const jogButtons =mount<>(<JogButtons {...jogButtonProps()} />);
const jogButtons = mount(<JogButtons {...jogButtonProps()} />);
const button = jogButtons.find("button").at(6);
expect(button.props().title).toBe("move x axis (100)");
button.simulate("click");
@ -82,7 +82,7 @@ describe("<JogButtons/>", function () {
const p = jogButtonProps();
(p.stepSize as number | undefined) = undefined;
p.xySwap = true;
const jogButtons =mount<>(<JogButtons {...p} />);
const jogButtons = mount(<JogButtons {...p} />);
const button = jogButtons.find("button").at(6);
expect(button.props().title).toBe("move y axis (100)");
button.simulate("click");

View file

@ -43,7 +43,7 @@ describe("<Move />", () => {
}
it("has default elements", () => {
const wrapper =mount<>(<Move {...fakeProps()} />);
const wrapper = mount(<Move {...fakeProps()} />);
const txt = wrapper.text().toLowerCase();
["move amount (mm)", "110100100010000", "x axisy axisz axis", "motor", "go"]
.map(string => expect(txt).toContain(string));
@ -52,7 +52,7 @@ describe("<Move />", () => {
it("has only raw encoder data display", () => {
const p = fakeProps();
mockConfig.raw_encoders = true;
const wrapper =mount<>(<Move {...p} />);
const wrapper = mount(<Move {...p} />);
const txt = wrapper.text().toLowerCase();
expect(txt).toContain("raw");
expect(txt).not.toContain("scaled");
@ -62,14 +62,14 @@ describe("<Move />", () => {
const p = fakeProps();
mockConfig.raw_encoders = true;
mockConfig.scaled_encoders = true;
const wrapper =mount<>(<Move {...p} />);
const wrapper = mount(<Move {...p} />);
const txt = wrapper.text().toLowerCase();
expect(txt).toContain("raw");
expect(txt).toContain("scaled");
});
it("toggle: invert jog button", () => {
const wrapper =mount<>(<Move {...fakeProps()} />);
const wrapper = mount(<Move {...fakeProps()} />);
// tslint:disable-next-line:no-any
const instance = wrapper.instance() as any;
instance.toggle(BooleanSetting.xy_swap)();
@ -78,7 +78,7 @@ describe("<Move />", () => {
it("changes step size", () => {
const p = fakeProps();
const wrapper =mount<>(<Move {...p} />);
const wrapper = mount(<Move {...p} />);
clickButton(wrapper, 0, "1");
expect(p.dispatch).toHaveBeenCalledWith({
type: Actions.CHANGE_STEP_SIZE,

View file

@ -9,7 +9,7 @@ describe("<ToggleButton/>", function () {
it("calls toggle action", () => {
const toggle = jest.fn();
const toggleButton =mount<>(<ToggleButton
const toggleButton = mount<{}>(<ToggleButton
toggleValue={0}
toggleAction={() => toggle()} />);
toggleButton.simulate("click");
@ -17,21 +17,21 @@ describe("<ToggleButton/>", function () {
});
it("displays no", () => {
const toggleButton =mount<>(<ToggleButton
const toggleButton = mount<{}>(<ToggleButton
toggleValue={0}
toggleAction={jest.fn()} />);
expect(toggleButton.text()).toBe("no");
});
it("displays yes", () => {
const toggleButton =mount<>(<ToggleButton
const toggleButton = mount<{}>(<ToggleButton
toggleValue={1}
toggleAction={jest.fn()} />);
expect(toggleButton.text()).toBe("yes");
});
it("displays off", () => {
const toggleButton =mount<>(<ToggleButton
const toggleButton = mount<{}>(<ToggleButton
toggleValue={0}
toggleAction={jest.fn()}
customText={{ textFalse: "off", textTrue: "on" }} />);
@ -39,7 +39,7 @@ describe("<ToggleButton/>", function () {
});
it("displays on", () => {
const toggleButton =mount<>(<ToggleButton
const toggleButton = mount<{}>(<ToggleButton
toggleValue={1}
toggleAction={jest.fn()}
customText={{ textFalse: "off", textTrue: "on" }} />);
@ -47,7 +47,7 @@ describe("<ToggleButton/>", function () {
});
it("displays 🚫", () => {
const toggleButton =mount<>(<ToggleButton
const toggleButton = mount<{}>(<ToggleButton
toggleValue={undefined}
toggleAction={jest.fn()}
customText={{ textFalse: "off", textTrue: "on" }} />);

View file

@ -27,7 +27,7 @@ describe("<Peripherals />", () => {
}
it("renders", () => {
const wrapper =mount<>(<Peripherals {...fakeProps()} />);
const wrapper = mount<Peripherals>(<Peripherals {...fakeProps()} />);
["Peripherals", "Edit", "Save", "Fake Pin", "1"].map(string =>
expect(wrapper.text()).toContain(string));
const saveButton = wrapper.find("button").at(1);
@ -36,7 +36,7 @@ describe("<Peripherals />", () => {
});
it("isEditing", () => {
const wrapper =mount<>(<Peripherals {...fakeProps()} />);
const wrapper = mount<Peripherals>(<Peripherals {...fakeProps()} />);
expect(wrapper.instance().state.isEditing).toBeFalsy();
clickButton(wrapper, 0, "edit");
expect(wrapper.instance().state.isEditing).toBeTruthy();
@ -46,7 +46,7 @@ describe("<Peripherals />", () => {
const p = fakeProps();
p.peripherals[0].body.pin = num;
p.peripherals[0].specialStatus = SpecialStatus.DIRTY;
const wrapper =mount<>(<Peripherals {...p} />);
const wrapper = mount<Peripherals>(<Peripherals {...p} />);
clickButton(wrapper, 1, "save", { partial_match: true });
expect(error).toHaveBeenLastCalledWith(errorString);
}
@ -63,14 +63,14 @@ describe("<Peripherals />", () => {
const p = fakeProps();
p.peripherals[0].body.pin = 1;
p.peripherals[0].specialStatus = SpecialStatus.DIRTY;
const wrapper =mount<>(<Peripherals {...p} />);
const wrapper = mount<Peripherals>(<Peripherals {...p} />);
clickButton(wrapper, 1, "save", { partial_match: true });
expect(p.dispatch).toHaveBeenCalled();
});
it("adds empty peripheral", () => {
const p = fakeProps();
const wrapper =mount<>(<Peripherals {...p} />);
const wrapper = mount<Peripherals>(<Peripherals {...p} />);
wrapper.setState({ isEditing: true });
clickButton(wrapper, 2, "");
expect(p.dispatch).toHaveBeenCalled();
@ -78,7 +78,7 @@ describe("<Peripherals />", () => {
it("adds farmduino peripherals", () => {
const p = fakeProps();
const wrapper =mount<>(<Peripherals {...p} />);
const wrapper = mount<Peripherals>(<Peripherals {...p} />);
wrapper.setState({ isEditing: true });
clickButton(wrapper, 3, "farmduino");
expect(p.dispatch).toHaveBeenCalledTimes(5);

View file

@ -29,7 +29,7 @@ describe("<PeripheralForm/>", function () {
];
it("renders a list of editable peripherals, in sorted order", function () {
const form =mount<>(<PeripheralForm dispatch={dispatch}
const form = mount<{}>(<PeripheralForm dispatch={dispatch}
peripherals={peripherals} />);
const inputs = form.find("input");
const buttons = form.find("button");

View file

@ -51,7 +51,7 @@ describe("<PeripheralList/>", function () {
};
it("renders a list of peripherals, in sorted order", function () {
const wrapper =mount<>(<PeripheralList dispatch={() => { }}
const wrapper = mount<{}>(<PeripheralList dispatch={() => { }}
peripherals={peripherals}
pins={pins}
disabled={false} />);
@ -71,7 +71,7 @@ describe("<PeripheralList/>", function () {
});
it("toggles pins", () => {
const wrapper =mount<>(<PeripheralList dispatch={() => { }}
const wrapper = mount<{}>(<PeripheralList dispatch={() => { }}
peripherals={peripherals}
pins={pins}
disabled={false} />);
@ -84,7 +84,7 @@ describe("<PeripheralList/>", function () {
});
it("pins toggles are disabled", () => {
const wrapper =mount<>(<PeripheralList dispatch={() => { }}
const wrapper = mount<{}>(<PeripheralList dispatch={() => { }}
peripherals={peripherals}
pins={pins}
disabled={true} />);

View file

@ -31,7 +31,7 @@ describe("<Sensors />", () => {
}
it("renders", () => {
const wrapper =mount<>(<Sensors {...fakeProps()} />);
const wrapper = mount<{}>(<Sensors {...fakeProps()} />);
["Sensors", "Edit", "Save", "Fake Pin", "1"].map(string =>
expect(wrapper.text()).toContain(string));
const saveButton = wrapper.find("button").at(1);
@ -40,7 +40,7 @@ describe("<Sensors />", () => {
});
it("isEditing", () => {
const wrapper =mount<>(<Sensors {...fakeProps()} />);
const wrapper = mount<Sensors>(<Sensors {...fakeProps()} />);
expect(wrapper.instance().state.isEditing).toBeFalsy();
clickButton(wrapper, 0, "edit");
expect(wrapper.instance().state.isEditing).toBeTruthy();
@ -51,7 +51,7 @@ describe("<Sensors />", () => {
p.sensors[0].body.pin = 1;
p.sensors[1].body.pin = 1;
p.sensors[0].specialStatus = SpecialStatus.DIRTY;
const wrapper =mount<>(<Sensors {...p} />);
const wrapper = mount<{}>(<Sensors {...p} />);
clickButton(wrapper, 1, "save", { partial_match: true });
expect(error).toHaveBeenLastCalledWith("Pin numbers must be unique.");
});
@ -60,14 +60,14 @@ describe("<Sensors />", () => {
const p = fakeProps();
p.sensors[0].body.pin = 1;
p.sensors[0].specialStatus = SpecialStatus.DIRTY;
const wrapper =mount<>(<Sensors {...p} />);
const wrapper = mount<{}>(<Sensors {...p} />);
clickButton(wrapper, 1, "save", { partial_match: true });
expect(p.dispatch).toHaveBeenCalled();
});
it("adds empty sensor", () => {
const p = fakeProps();
const wrapper =mount<>(<Sensors {...p} />);
const wrapper = mount<{}>(<Sensors {...p} />);
wrapper.setState({ isEditing: true });
clickButton(wrapper, 2, "");
expect(p.dispatch).toHaveBeenCalled();
@ -75,7 +75,7 @@ describe("<Sensors />", () => {
it("adds stock sensors", () => {
const p = fakeProps();
const wrapper =mount<>(<Sensors {...p} />);
const wrapper = mount<{}>(<Sensors {...p} />);
wrapper.setState({ isEditing: true });
clickButton(wrapper, 3, "stock sensors");
expect(p.dispatch).toHaveBeenCalledTimes(2);

View file

@ -47,7 +47,7 @@ describe("<SensorList/>", function () {
};
it("renders a list of sensors, in sorted order", function () {
const wrapper =mount<>(<SensorList {...fakeProps()} />);
const wrapper = mount<{}>(<SensorList {...fakeProps()} />);
const labels = wrapper.find("label");
const pinNumbers = wrapper.find("p");
expect(labels.first().text()).toEqual("GPIO 51");
@ -73,7 +73,7 @@ describe("<SensorList/>", function () {
});
it("reads pins", () => {
const wrapper =mount<>(<SensorList {...fakeProps()} />);
const wrapper = mount<{}>(<SensorList {...fakeProps()} />);
const toggle = wrapper.find("button");
toggle.first().simulate("click");
expect(mockDevice.send).toHaveBeenCalledWith(expectedPayload(51, 1));
@ -85,7 +85,7 @@ describe("<SensorList/>", function () {
it("pins toggles are disabled", () => {
const p = fakeProps();
p.disabled = true;
const wrapper =mount<>(<SensorList {...p} />);
const wrapper = mount<{}>(<SensorList {...p} />);
const toggle = wrapper.find("button");
toggle.first().simulate("click");
toggle.last().simulate("click");

View file

@ -17,7 +17,7 @@ describe("<Edit/>", () => {
it("renders the list of feeds", () => {
const p = fakeProps();
const wrapper =mount<>(<Edit {...p} />);
const wrapper = mount<{}>(<Edit {...p} />);
[
p.feeds[0].body.name,
p.feeds[0].body.url,
@ -29,7 +29,7 @@ describe("<Edit/>", () => {
it("saves feeds", () => {
const p = fakeProps();
const wrapper =mount<>(<Edit {...p} />);
const wrapper = mount<{}>(<Edit {...p} />);
clickButton(wrapper, 1, "save*");
expect(p.save).toHaveBeenCalledWith(p.feeds[0]);
});
@ -38,7 +38,7 @@ describe("<Edit/>", () => {
const p = fakeProps();
p.feeds[0].specialStatus = SpecialStatus.SAVED;
p.feeds[1].specialStatus = SpecialStatus.SAVED;
const wrapper =mount<>(<Edit {...p} />);
const wrapper = mount<{}>(<Edit {...p} />);
expect(wrapper.find("button").at(1).text()).toEqual("Save");
});
});

View file

@ -13,7 +13,7 @@ import { clickButton, allButtonText } from "../../../__test_support__/helpers";
describe("<WebcamPanel/>", () => {
it("toggles form state to edit", () => {
const props = { feeds: [], dispatch: jest.fn() };
const wrapper =mount<>(<WebcamPanel {...props} />);
const wrapper = mount<WebcamPanel>(<WebcamPanel {...props} />);
expect(wrapper.instance().state.activeMenu).toEqual("show");
const text = allButtonText(wrapper);
expect(text.toLowerCase()).not.toContain("view");
@ -23,7 +23,7 @@ describe("<WebcamPanel/>", () => {
it("toggles form state to view", () => {
const props = { feeds: [], dispatch: jest.fn() };
const wrapper =mount<>(<WebcamPanel {...props} />);
const wrapper = mount<WebcamPanel>(<WebcamPanel {...props} />);
wrapper.setState({ activeMenu: "edit" });
const text = allButtonText(wrapper);
expect(text.toLowerCase()).not.toContain("edit");

View file

@ -9,7 +9,7 @@ describe("<Show/>", () => {
const feed1 = fakeWebcamFeed();
const feed2 = fakeWebcamFeed();
const p = props([feed1, feed2]);
const el =mount<>(<Show {...p} />);
const el = mount<{}>(<Show {...p} />);
expect(el.text()).toContain(feed1.body.name);
el.find(".image-flipper-right").first().simulate("click");
el.render();
@ -19,19 +19,19 @@ describe("<Show/>", () => {
describe("<IndexIndicator/>", () => {
it("renders index indicator: position 1", () => {
const wrapper =mount<>(<IndexIndicator i={0} total={2} />);
const wrapper = mount<{}>(<IndexIndicator i={0} total={2} />);
expect(wrapper.find("div").props().style)
.toEqual({ left: "calc(-10px + 0 * 50%)", width: "50%" });
});
it("renders index indicator: position 2", () => {
const wrapper =mount<>(<IndexIndicator i={1} total={4} />);
const wrapper = mount<{}>(<IndexIndicator i={1} total={4} />);
expect(wrapper.find("div").props().style)
.toEqual({ left: "calc(-10px + 1 * 25%)", width: "25%" });
});
it("doesn't render index indicator", () => {
const wrapper =mount<>(<IndexIndicator i={0} total={1} />);
const wrapper = mount<{}>(<IndexIndicator i={0} total={1} />);
expect(wrapper.html()).toEqual("<div></div>");
});
});

View file

@ -9,7 +9,7 @@ import { bot } from "../../../__test_support__/fake_state/bot";
describe("BooleanMCUInputGroup", () => {
it("triggers callbacks", () => {
const dispatch = jest.fn();
const el =mount<>(<BooleanMCUInputGroup
const el = mount<{}>(<BooleanMCUInputGroup
sourceFwConfig={(x) => {
return { value: bot.hardware.mcu_params[x], consistent: true };
}}

View file

@ -17,7 +17,7 @@ describe("<DiagnosticDumpRow/>", () => {
const dispatch = jest.fn();
const diag = fakeDiagnosticDump();
diag.body.ticket_identifier = "0000";
const el =mount<>(<DiagnosticDumpRow dispatch={dispatch} diag={diag} />);
const el = mount<{}>(<DiagnosticDumpRow dispatch={dispatch} diag={diag} />);
expect(el.text()).toContain("0000");
el.find("a").first().simulate("click");
expect(jsonDownload).toHaveBeenCalledWith(diag.body, "farmbot_diagnostics_0000.json");

View file

@ -7,14 +7,14 @@ import { taggedUser } from "../../../__test_support__/user";
describe("<EStopButton />", () => {
it("renders", () => {
bot.hardware.informational_settings.sync_status = "synced";
const wrapper =mount<>(<EStopButton bot={bot} user={taggedUser} />);
const wrapper = mount<{}>(<EStopButton bot={bot} user={taggedUser} />);
expect(wrapper.text()).toEqual("E-STOP");
expect(wrapper.find("button").hasClass("red")).toBeTruthy();
});
it("grayed out", () => {
bot.hardware.informational_settings.sync_status = undefined;
const wrapper =mount<>(<EStopButton bot={bot} user={taggedUser} />);
const wrapper = mount<{}>(<EStopButton bot={bot} user={taggedUser} />);
expect(wrapper.text()).toEqual("E-STOP");
expect(wrapper.find("button").hasClass("gray")).toBeTruthy();
});
@ -22,7 +22,7 @@ describe("<EStopButton />", () => {
it("locked", () => {
bot.hardware.informational_settings.sync_status = "synced";
bot.hardware.informational_settings.locked = true;
const wrapper =mount<>(<EStopButton bot={bot} user={taggedUser} />);
const wrapper = mount<{}>(<EStopButton bot={bot} user={taggedUser} />);
expect(wrapper.text()).toEqual("UNLOCK");
expect(wrapper.find("button").hasClass("yellow")).toBeTruthy();
});

View file

@ -40,7 +40,7 @@ describe("<FarmbotOsSettings/>", () => {
};
it("renders settings", () => {
const osSettings =mount<>(<FarmbotOsSettings {...fakeProps()} />);
const osSettings = mount<{}>(<FarmbotOsSettings {...fakeProps()} />);
expect(osSettings.find("input").length).toBe(1);
expect(osSettings.find("button").length).toBe(6);
["NAME", "TIME ZONE", "LAST SEEN", "FARMBOT OS", "CAMERA", "FIRMWARE"]
@ -49,7 +49,7 @@ describe("<FarmbotOsSettings/>", () => {
it("fetches OS release notes", async () => {
mockReleaseNoteData = { data: "intro\n\n# v6\n\n* note" };
const osSettings = awaitmount<>(<FarmbotOsSettings {...fakeProps()} />);
const osSettings = await mount<FarmbotOsSettings>(<FarmbotOsSettings {...fakeProps()} />);
await expect(axios.get).toHaveBeenCalledWith(
expect.stringContaining("RELEASE_NOTES.md"));
expect(osSettings.instance().state.osReleaseNotes)
@ -58,7 +58,7 @@ describe("<FarmbotOsSettings/>", () => {
it("doesn't fetch OS release notes", async () => {
mockReleaseNoteData = { data: "empty notes" };
const osSettings = awaitmount<>(<FarmbotOsSettings {...fakeProps()} />);
const osSettings = await mount<FarmbotOsSettings>(<FarmbotOsSettings {...fakeProps()} />);
await expect(axios.get).toHaveBeenCalledWith(
expect.stringContaining("RELEASE_NOTES.md"));
expect(osSettings.instance().state.osReleaseNotes)
@ -94,7 +94,7 @@ describe("<FbosDetails />", () => {
};
it("renders", () => {
const wrapper =mount<>(<FbosDetails {...fakeProps()} />);
const wrapper = mount<{}>(<FbosDetails {...fakeProps()} />);
["Environment: ---",
"Commit: ---",
"Target: ---",

View file

@ -31,7 +31,7 @@ describe("<HardwareSettings />", () => {
};
it("renders", () => {
const wrapper =mount<>(<HardwareSettings {...fakeProps()} />);
const wrapper = mount<{}>(<HardwareSettings {...fakeProps()} />);
["expand all", "x axis", "motors"].map(string =>
expect(wrapper.text().toLowerCase()).toContain(string));
});
@ -43,7 +43,7 @@ describe("<HardwareSettings />", () => {
type: string,
payload: boolean | string) {
const p = fakeProps();
const wrapper =mount<>(<HardwareSettings {...p} />);
const wrapper = mount<{}>(<HardwareSettings {...p} />);
clickButton(wrapper, buttonIndex, buttonText, {
button_tag: buttonElement, partial_match: true
});
@ -82,7 +82,7 @@ describe("<HardwareSettings />", () => {
describe("<FwParamExportMenu />", () => {
it("lists all params", () => {
const config = fakeFirmwareConfig().body;
const wrapper =mount<>(<FwParamExportMenu firmwareConfig={config} />);
const wrapper = mount<{}>(<FwParamExportMenu firmwareConfig={config} />);
expect(wrapper.text()).toContain("movement_max_spd_");
});
});

View file

@ -5,13 +5,13 @@ import { mount } from "enzyme";
describe("<LockableButton/>", () => {
it("does not trigger callback when clicked and disabled", () => {
const fakeCB = jest.fn();
const btn =mount<>(<LockableButton disabled={true} onClick={fakeCB} />);
const btn = mount<{}>(<LockableButton disabled={true} onClick={fakeCB} />);
btn.simulate("click");
expect(fakeCB).not.toHaveBeenCalled();
});
it("does trigger callback when clicked and enabled", () => {
const fakeCB = jest.fn();
const btn =mount<>(<LockableButton disabled={false} onClick={fakeCB} />);
const btn = mount<{}>(<LockableButton disabled={false} onClick={fakeCB} />);
btn.simulate("click");
expect(fakeCB).toHaveBeenCalled();
});

View file

@ -51,7 +51,7 @@ describe("<PinBindings/>", () => {
}
it("renders", () => {
const wrapper =mount<>(<PinBindings {...fakeProps()} />);
const wrapper = mount<{}>(<PinBindings {...fakeProps()} />);
["pin bindings", "pin number", "none", "bind"].map(string =>
expect(wrapper.text().toLowerCase()).toContain(string));
["pi gpio 10", "sequence 1", "pi gpio 11", "sequence 2"].map(string =>
@ -64,7 +64,7 @@ describe("<PinBindings/>", () => {
it("unregisters pin: bot", () => {
const p = fakeProps();
p.dispatch = jest.fn(x => x(jest.fn()));
const wrapper =mount<>(<PinBindings {...p} />);
const wrapper = mount<{}>(<PinBindings {...p} />);
const buttons = wrapper.find("button");
buttons.first().simulate("click");
expect(mockDevice.unregisterGpio).toHaveBeenCalledWith({
@ -78,7 +78,7 @@ describe("<PinBindings/>", () => {
s.body.id = 1;
p.resources = buildResourceIndex([fakePinBinding(), s]).index;
p.shouldDisplay = () => true;
const wrapper =mount<>(<PinBindings {...p} />);
const wrapper = mount<{}>(<PinBindings {...p} />);
const buttons = wrapper.find("button");
buttons.first().simulate("click");
expect(mockDevice.unregisterGpio).not.toHaveBeenCalled();
@ -88,7 +88,7 @@ describe("<PinBindings/>", () => {
it("registers pin: bot", () => {
const p = fakeProps();
p.dispatch = jest.fn(x => x(jest.fn()));
const wrapper =mount<>(<PinBindings {...p} />);
const wrapper = mount<{}>(<PinBindings {...p} />);
const buttons = wrapper.find("button");
expect(buttons.last().text()).toEqual("BIND");
wrapper.setState({ pinNumberInput: 1, sequenceIdInput: 2 });
@ -102,7 +102,7 @@ describe("<PinBindings/>", () => {
const p = fakeProps();
p.dispatch = jest.fn();
p.shouldDisplay = () => true;
const wrapper =mount<>(<PinBindings {...p} />);
const wrapper = mount<{}>(<PinBindings {...p} />);
const buttons = wrapper.find("button");
expect(buttons.last().text()).toEqual("BIND");
wrapper.setState({ pinNumberInput: 1, sequenceIdInput: 2 });
@ -117,7 +117,7 @@ describe("<PinBindings/>", () => {
const p = fakeProps();
const s = p.resources.references[p.resources.byKind.Sequence[0]];
const id = s && s.body.id;
const wrapper =mount<>(<PinBindings {...p} />);
const wrapper = mount<PinBindings>(<PinBindings {...p} />);
expect(wrapper.instance().state.sequenceIdInput).toEqual(undefined);
// tslint:disable-next-line:no-any
const instance = wrapper.instance() as any;
@ -126,7 +126,7 @@ describe("<PinBindings/>", () => {
});
it("sets pin", () => {
const wrapper =mount<>(<PinBindings {...fakeProps()} />);
const wrapper = mount<PinBindings>(<PinBindings {...fakeProps()} />);
expect(wrapper.instance().state.pinNumberInput).toEqual(undefined);
// tslint:disable-next-line:no-any
const instance = wrapper.instance() as any;

View file

@ -25,7 +25,7 @@ describe("<PinGuardMCUInputGroup/>", () => {
it("calls toggle action ", () => {
const p = fakeProps();
const wrapper =mount<>(<PinGuardMCUInputGroup {...p} />);
const wrapper = mount<{}>(<PinGuardMCUInputGroup {...p} />);
wrapper.find("button").simulate("click");
expect(settingToggle).toHaveBeenCalledWith("pin_guard_1_active_state",
expect.any(Function));

View file

@ -13,12 +13,12 @@ describe("<RpiGpioDiagram />", () => {
}
it("renders", () => {
const wrapper =mount<>(<RpiGpioDiagram {...fakeProps()} />);
const wrapper = mount<RpiGpioDiagram>(<RpiGpioDiagram {...fakeProps()} />);
expect(wrapper.find("rect").length).toEqual(42);
});
it("pin hover", () => {
const wrapper =mount<>(<RpiGpioDiagram {...fakeProps()} />);
const wrapper = mount<RpiGpioDiagram>(<RpiGpioDiagram {...fakeProps()} />);
wrapper.find("rect").at(5).simulate("mouseEnter");
expect(wrapper.instance().state.hoveredPin).toEqual("GND");
const pinToHover = wrapper.find("rect").at(6);
@ -32,7 +32,7 @@ describe("<RpiGpioDiagram />", () => {
it("pin click", () => {
const p = fakeProps();
const wrapper =mount<>(<RpiGpioDiagram {...p} />);
const wrapper = mount<RpiGpioDiagram>(<RpiGpioDiagram {...p} />);
wrapper.find("rect").at(6).simulate("click");
expect(p.setSelectedPin).toHaveBeenCalledWith(17);
jest.clearAllMocks();

View file

@ -25,14 +25,14 @@ describe("<AutoSyncRow/>", () => {
};
it("renders", () => {
const wrapper =mount<>(<AutoSyncRow {...fakeProps() } />);
const wrapper = mount<{}>(<AutoSyncRow {...fakeProps() } />);
["AUTO SYNC", Content.AUTO_SYNC]
.map(string => expect(wrapper.text()).toContain(string));
});
it("toggles", () => {
bot.hardware.configuration.auto_sync = true;
const wrapper =mount<>(<AutoSyncRow {...fakeProps() } />);
const wrapper = mount<{}>(<AutoSyncRow {...fakeProps() } />);
wrapper.find("button").simulate("click");
expect(mockDevice.updateConfig)
.toHaveBeenCalledWith({ auto_sync: false });

View file

@ -27,13 +27,13 @@ describe("<AutoUpdateRow/>", () => {
};
it("renders", () => {
const wrapper =mount<>(<AutoUpdateRow {...fakeProps() } />);
const wrapper = mount<{}>(<AutoUpdateRow {...fakeProps() } />);
expect(wrapper.text().toLowerCase()).toContain("auto update");
});
it("toggles auto-update on", () => {
bot.hardware.configuration.os_auto_update = 0;
const wrapper =mount<>(<AutoUpdateRow {...fakeProps() } />);
const wrapper = mount<{}>(<AutoUpdateRow {...fakeProps() } />);
wrapper.find("button").first().simulate("click");
expect(mockDevice.updateConfig)
.toHaveBeenCalledWith({ os_auto_update: 1 });
@ -41,7 +41,7 @@ describe("<AutoUpdateRow/>", () => {
it("toggles auto-update off", () => {
bot.hardware.configuration.os_auto_update = 1;
const wrapper =mount<>(<AutoUpdateRow {...fakeProps() } />);
const wrapper = mount<{}>(<AutoUpdateRow {...fakeProps() } />);
wrapper.find("button").first().simulate("click");
expect(mockDevice.updateConfig)
.toHaveBeenCalledWith({ os_auto_update: 0 });

View file

@ -33,28 +33,28 @@ describe("<BoardType/>", () => {
it("Farmduino", () => {
const p = fakeProps();
p.firmwareVersion = "5.0.3.F";
const wrapper =mount<>(<BoardType {...p} />);
const wrapper = mount<{}>(<BoardType {...p} />);
expect(wrapper.text()).toContain("Farmduino");
});
it("Farmduino k1.4", () => {
const p = fakeProps();
p.firmwareVersion = "5.0.3.G";
const wrapper =mount<>(<BoardType {...p} />);
const wrapper = mount<{}>(<BoardType {...p} />);
expect(wrapper.text()).toContain("1.4");
});
it("Arduino/RAMPS", () => {
const p = fakeProps();
p.firmwareVersion = "5.0.3.R";
const wrapper =mount<>(<BoardType {...p} />);
const wrapper = mount<{}>(<BoardType {...p} />);
expect(wrapper.text()).toContain("Arduino/RAMPS");
});
it("Undefined", () => {
const p = fakeProps();
p.firmwareVersion = undefined;
const wrapper =mount<>(<BoardType {...p} />);
const wrapper = mount<{}>(<BoardType {...p} />);
expect(wrapper.text()).toContain("None");
});
@ -69,7 +69,7 @@ describe("<BoardType/>", () => {
it("Stubbed", () => {
const p = fakeProps();
p.firmwareVersion = "STUBFW";
const wrapper =mount<>(<BoardType {...p} />);
const wrapper = mount<{}>(<BoardType {...p} />);
expect(wrapper.text()).toContain("None");
});
@ -77,7 +77,7 @@ describe("<BoardType/>", () => {
const p = fakeProps();
p.firmwareVersion = "Arduino Disconnected!";
p.sourceFbosConfig = () => ({ value: "farmduino", consistent: false });
const wrapper =mount<>(<BoardType {...p} />);
const wrapper = mount<{}>(<BoardType {...p} />);
expect(wrapper.text()).toContain("Farmduino");
});

View file

@ -26,14 +26,14 @@ describe("<CameraSelection/>", () => {
};
it("doesn't render camera", () => {
const cameraSelection =mount<>(<CameraSelection {...fakeProps()} />);
const cameraSelection = mount<{}>(<CameraSelection {...fakeProps()} />);
expect(cameraSelection.find("button").text()).toEqual("USB Camera");
});
it("renders camera", () => {
const p = fakeProps();
p.env = { "camera": "\"RPI\"" };
const cameraSelection =mount<>(<CameraSelection {...p} />);
const cameraSelection = mount<{}>(<CameraSelection {...p} />);
expect(cameraSelection.find("button").text()).toEqual("Raspberry Pi Camera");
});

View file

@ -18,13 +18,13 @@ describe("<ChangeOwnershipForm/>", () => {
beforeEach(() => API.setBaseUrl("https://my.farm.bot"));
it("renders", () => {
const wrapper =mount<>(<ChangeOwnershipForm />);
const wrapper = mount<{}>(<ChangeOwnershipForm />);
["email", "password", "server"]
.map(string => expect(wrapper.text().toLowerCase()).toContain(string));
});
it("submits", () => {
const wrapper =mount<>(<ChangeOwnershipForm />);
const wrapper = mount<{}>(<ChangeOwnershipForm />);
wrapper.find("button").simulate("click");
expect(transferOwnership).toHaveBeenCalledWith({
device: mockDevice,

View file

@ -56,7 +56,7 @@ describe("<FbosDetails/>", () => {
it("toggles os beta opt in setting on", () => {
bot.hardware.configuration.beta_opt_in = false;
const wrapper =mount<>(<FbosDetails {...fakeProps()} />);
const wrapper = mount<{}>(<FbosDetails {...fakeProps()} />);
window.confirm = jest.fn();
wrapper.find("button").simulate("click");
expect(window.confirm).toHaveBeenCalledWith(
@ -70,7 +70,7 @@ describe("<FbosDetails/>", () => {
it("toggles os beta opt in setting off", () => {
bot.hardware.configuration.beta_opt_in = true;
const wrapper =mount<>(<FbosDetails {...fakeProps()} />);
const wrapper = mount<{}>(<FbosDetails {...fakeProps()} />);
window.confirm = () => false;
wrapper.find("button").simulate("click");
expect(mockDevice.updateConfig)

View file

@ -23,12 +23,12 @@ describe("<LastSeen/>", () => {
it("blinks when loading", () => {
const p = props();
p.device.specialStatus = SpecialStatus.SAVING;
const wrapper =mount<>(<LastSeen {...p} />);
const wrapper = mount<{}>(<LastSeen {...p} />);
expect(wrapper.text()).toContain("Loading");
});
it("tells you the device has never been seen", () => {
const wrapper =mount<>(<LastSeen {...props() } />);
const wrapper = mount<{}>(<LastSeen {...props() } />);
expect(wrapper.text()).toContain("network connectivity issue");
});
@ -36,7 +36,7 @@ describe("<LastSeen/>", () => {
const p = props();
p.device.body.last_saw_api = "2017-08-07T19:40:01.487Z";
p.botToMqttLastSeen = "";
const wrapper =mount<>(<LastSeen {...p} />);
const wrapper = mount<{}>(<LastSeen {...p} />);
// tslint:disable-next-line:no-any
const instance = wrapper.instance() as any;
expect(instance.lastSeen).toEqual("2017-08-07T19:40:01.487Z");
@ -46,7 +46,7 @@ describe("<LastSeen/>", () => {
const p = props();
p.device.body.last_saw_api = "2017-08-07T19:40:01.487Z";
p.botToMqttLastSeen = "2017-08-07T20:40:01.487Z";
const wrapper =mount<>(<LastSeen {...p} />);
const wrapper = mount<{}>(<LastSeen {...p} />);
// tslint:disable-next-line:no-any
const instance = wrapper.instance() as any;
expect(instance.lastSeen).toEqual("2017-08-07T20:40:01.487Z");
@ -54,7 +54,7 @@ describe("<LastSeen/>", () => {
it("handles a click", () => {
const p = props();
const wrapper =mount<>(<LastSeen {...p} />);
const wrapper = mount<{}>(<LastSeen {...p} />);
wrapper.find("i").simulate("click");
expect(p.onClick).toHaveBeenCalled();
});

View file

@ -33,7 +33,7 @@ describe("<OsUpdateButton/>", () => {
it("renders buttons: not connected", () => {
bot.currentOSVersion = undefined;
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
expect(buttons.find("button").length).toBe(1);
const autoUpdate = buttons.find("button").first();
expect(autoUpdate.hasClass("yellow")).toBeTruthy();
@ -42,7 +42,7 @@ describe("<OsUpdateButton/>", () => {
});
it("renders buttons: not connected to bot", () => {
bot.hardware.informational_settings.controller_version = undefined;
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
expect(buttons.find("button").length).toBe(1);
const autoUpdate = buttons.find("button").first();
expect(autoUpdate.hasClass("yellow")).toBeTruthy();
@ -51,7 +51,7 @@ describe("<OsUpdateButton/>", () => {
});
it("renders buttons: no beta releases", () => {
bot.hardware.configuration.beta_opt_in = true;
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
expect(buttons.find("button").length).toBe(1);
const autoUpdate = buttons.find("button").first();
expect(autoUpdate.hasClass("yellow")).toBeTruthy();
@ -60,21 +60,21 @@ describe("<OsUpdateButton/>", () => {
});
it("up to date", () => {
bot.hardware.informational_settings.controller_version = "3.1.6";
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe("UP TO DATE");
expect(osUpdateButton.props().title).toBe("3.1.6");
});
it("up to date: newer", () => {
bot.hardware.informational_settings.controller_version = "5.0.0";
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe("UP TO DATE");
expect(osUpdateButton.props().title).toBe("3.1.6");
});
it("update available", () => {
bot.hardware.informational_settings.controller_version = "3.1.5";
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe("UPDATE");
expect(osUpdateButton.props().title).toBe("3.1.6");
@ -83,7 +83,7 @@ describe("<OsUpdateButton/>", () => {
bot.hardware.informational_settings.controller_version = "3.1.5";
bot.hardware.configuration.beta_opt_in = true;
bot.currentBetaOSVersion = "5.0.0-beta";
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe("UPDATE");
expect(osUpdateButton.props().title).toBe("5.0.0-beta");
@ -94,13 +94,13 @@ describe("<OsUpdateButton/>", () => {
bot.hardware.configuration.beta_opt_in = true;
bot.currentBetaOSVersion = "5.0.0-beta";
bot.currentBetaOSCommit = "new commit";
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe("UPDATE");
expect(osUpdateButton.props().title).toBe("5.0.0-beta");
});
it("calls checkUpdates", () => {
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
osUpdateButton.simulate("click");
expect(mockDevice.checkUpdates).toHaveBeenCalledTimes(1);
@ -111,7 +111,7 @@ describe("<OsUpdateButton/>", () => {
bot.hardware.jobs = {
"FBOS_OTA": { status: "working", bytes: progress, unit: "bytes" }
};
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe(text);
});
@ -124,7 +124,7 @@ describe("<OsUpdateButton/>", () => {
bot.hardware.jobs = {
"FBOS_OTA": { status: "working", percent: 10, unit: "percent" }
};
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe("10%");
});
@ -133,7 +133,7 @@ describe("<OsUpdateButton/>", () => {
"FBOS_OTA": { status: "complete", percent: 100, unit: "percent" }
};
bot.hardware.informational_settings.controller_version = "3.1.6";
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe("UP TO DATE");
});
@ -142,7 +142,7 @@ describe("<OsUpdateButton/>", () => {
"FBOS_OTA": { status: "error", percent: 10, unit: "percent" }
};
bot.hardware.informational_settings.controller_version = "3.1.5";
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
expect(osUpdateButton.text()).toBe("UPDATE");
});
@ -150,7 +150,7 @@ describe("<OsUpdateButton/>", () => {
bot.hardware.jobs = {
"FBOS_OTA": { status: "working", percent: 10, unit: "percent" }
};
const buttons =mount<>(<OsUpdateButton {...fakeProps()} />);
const buttons = mount<{}>(<OsUpdateButton {...fakeProps()} />);
const osUpdateButton = buttons.find("button").last();
osUpdateButton.simulate("click");
expect(mockDevice.checkUpdates).not.toHaveBeenCalled();

View file

@ -29,7 +29,7 @@ describe("<PowerAndReset/>", () => {
it("open", () => {
const p = fakeProps();
p.controlPanelState.power_and_reset = true;
const wrapper =mount<>(<PowerAndReset {...p} />);
const wrapper = mount<{}>(<PowerAndReset {...p} />);
["Power and Reset", "Restart", "Shutdown", "Factory Reset",
"Automatic Factory Reset", "Connection Attempt Period"]
.map(string => expect(wrapper.text().toLowerCase())
@ -39,7 +39,7 @@ describe("<PowerAndReset/>", () => {
it("closed", () => {
const p = fakeProps();
p.controlPanelState.power_and_reset = false;
const wrapper =mount<>(<PowerAndReset {...p} />);
const wrapper = mount<{}>(<PowerAndReset {...p} />);
expect(wrapper.text().toLowerCase())
.toContain("Power and Reset".toLowerCase());
expect(wrapper.text().toLowerCase())
@ -50,7 +50,7 @@ describe("<PowerAndReset/>", () => {
bot.hardware.configuration.disable_factory_reset = true;
const p = fakeProps();
p.controlPanelState.power_and_reset = true;
const wrapper =mount<>(<PowerAndReset {...p} />);
const wrapper = mount<{}>(<PowerAndReset {...p} />);
expect(wrapper.find("input").last().props().disabled).toBeTruthy();
expect(wrapper.find("label").last().props().style)
.toEqual({ color: "grey" });
@ -60,7 +60,7 @@ describe("<PowerAndReset/>", () => {
bot.hardware.configuration.disable_factory_reset = false;
const p = fakeProps();
p.controlPanelState.power_and_reset = true;
const wrapper =mount<>(<PowerAndReset {...p} />);
const wrapper = mount<{}>(<PowerAndReset {...p} />);
wrapper.find("button").at(3).simulate("click");
expect(mockDevice.updateConfig)
.toHaveBeenCalledWith({ disable_factory_reset: true });

View file

@ -14,7 +14,7 @@ describe("<HomingRow />", () => {
jest.clearAllMocks();
});
it("calls device", () => {
const result =mount<>(<CalibrationRow
const result = mount<{}>(<CalibrationRow
hardware={bot.hardware.mcu_params}
botDisconnected={false} />);
[0, 1, 2].map(i => result.find("LockableButton").at(i).simulate("click"));

View file

@ -21,13 +21,13 @@ describe("<EncodersAndEndStops />", () => {
it("doesn't show new inversion param", () => {
mockFeatures.endstop_invert = false;
const wrapper =mount<>(<EncodersAndEndStops {...fakeProps()} />);
const wrapper = mount<{}>(<EncodersAndEndStops {...fakeProps()} />);
expect(wrapper.text().toLowerCase()).not.toContain("invert endstops");
});
it("shows new inversion param", () => {
mockFeatures.endstop_invert = true;
const wrapper =mount<>(<EncodersAndEndStops {...fakeProps()} />);
const wrapper = mount<{}>(<EncodersAndEndStops {...fakeProps()} />);
expect(wrapper.text().toLowerCase()).not.toContain("invert endstops");
});
});

View file

@ -24,7 +24,7 @@ describe("<HomingAndCalibration />", () => {
const dispatch = jest.fn();
bot.controlPanelState.homing_and_calibration = true;
bot.hardware.informational_settings.firmware_version = fw;
const result =mount<>(<HomingAndCalibration
const result = mount<{}>(<HomingAndCalibration
dispatch={dispatch}
bot={bot}
firmwareConfig={fakeFirmwareConfig().body}

View file

@ -16,7 +16,7 @@ describe("<HomingRow />", () => {
});
it("renders three buttons", () => {
const wrapper =mount<>(<HomingRow
const wrapper = mount<{}>(<HomingRow
hardware={bot.hardware.mcu_params}
botDisconnected={false} />);
const txt = wrapper.text().toUpperCase();
@ -26,7 +26,7 @@ describe("<HomingRow />", () => {
});
it("calls device", () => {
const result =mount<>(<HomingRow
const result = mount<{}>(<HomingRow
hardware={bot.hardware.mcu_params}
botDisconnected={false} />);
[0, 1, 2].map(i =>

View file

@ -76,7 +76,7 @@ describe("<Motors/>", () => {
const p = fakeProps();
p.controlPanelState.motors = true;
bot.hardware.mcu_params[parameter] = 1;
const wrapper =mount<>(<Motors {...p} />);
const wrapper = mount<{}>(<Motors {...p} />);
wrapper.find("button").at(position).simulate("click");
expect(mockDevice.updateMcu)
.toHaveBeenCalledWith({ [parameter]: 0 });

View file

@ -13,7 +13,7 @@ describe("<HomingRow />", () => {
jest.clearAllMocks();
});
it("calls device", () => {
const result =mount<>(<ZeroRow botDisconnected={false} />);
const result = mount<{}>(<ZeroRow botDisconnected={false} />);
[0, 1, 2].map(i => result.find("ZeroButton").at(i).simulate("click"));
["x", "y", "z"].map(x =>
expect(mockDevice.setZero).toHaveBeenCalledWith(x));

View file

@ -5,7 +5,7 @@ import { mount } from "enzyme";
describe("<Diagnosis/>", () => {
it("renders help text", () => {
const el =mount<>(<Diagnosis
const el = mount<{}>(<Diagnosis
userAPI={true}
userMQTT={true}
botMQTT={true}
@ -16,7 +16,7 @@ describe("<Diagnosis/>", () => {
});
it("renders diagnosis error color", () => {
const el =mount<>(<Diagnosis
const el = mount<{}>(<Diagnosis
userAPI={true}
userMQTT={true}
botMQTT={true}

View file

@ -58,14 +58,14 @@ describe("<ConnectivityDiagram/>", () => {
}
it("renders diagram", () => {
const wrapper =mount<>(<ConnectivityDiagram {...fakeProps() } />);
const wrapper = mount<{}>(<ConnectivityDiagram {...fakeProps() } />);
expect(wrapper.text())
.toContain("BrowserWeb AppMessage BrokerFarmBotRaspberry PiF");
});
it("hover", () => {
const p = fakeProps();
const wrapper =mount<>(<ConnectivityDiagram {...p } />);
const wrapper = mount<{}>(<ConnectivityDiagram {...p } />);
wrapper.find(".connector-hover-area").first().simulate("mouseEnter");
expect(p.hover).toHaveBeenCalledWith("EF");
});
@ -130,7 +130,7 @@ describe("<Connector/>", () => {
}
it("renders", () => {
const wrapper =mount<>(<Connector {...fakeProps() } />);
const wrapper = mount<{}>(<Connector {...fakeProps() } />);
const lines = wrapper.find("line");
expect(lines.length).toEqual(3);
expect(lines.at(0).props())
@ -154,7 +154,7 @@ describe("<Connector/>", () => {
it("renders connected color", () => {
const p = fakeProps();
p.connectionData.connectionStatus = true;
const wrapper =mount<>(<Connector {...p } />);
const wrapper = mount<{}>(<Connector {...p } />);
expect(wrapper.find("line").at(1).props().stroke).toEqual(Color.green);
});
});

View file

@ -37,7 +37,7 @@ describe("<ConnectivityPanel/>", () => {
it("sets hovered connection", () => {
const testcase = test();
const el = mount(testcase.component);
const el = mount<ConnectivityPanel>(testcase.component);
el.find(".saucer").last().simulate("mouseEnter");
expect(el.instance().state.hoveredConnection).toEqual("AB");
});

View file

@ -12,7 +12,7 @@ describe("<DropArea />", () => {
};
it("opens", () => {
const wrapper = shallow(<DropArea {...props()} />);
const wrapper = shallow<DropArea>(<DropArea {...props()} />);
wrapper.setState({ isHovered: true });
expect(wrapper.hasClass("drag-drop-area")).toBeTruthy();
});
@ -20,18 +20,18 @@ describe("<DropArea />", () => {
it("is locked open", () => {
const p = props();
p.isLocked = true;
const wrapper = shallow(<DropArea {...p} />);
const wrapper = shallow<DropArea>(<DropArea {...p} />);
expect(wrapper.hasClass("drag-drop-area")).toBeTruthy();
});
it("renders children", () => {
const wrapper = shallow(<DropArea {...props()}>children</DropArea>);
const wrapper = shallow<DropArea>(<DropArea {...props()}>children</DropArea>);
expect(wrapper.text()).toEqual("children");
});
it("handles drag enter", () => {
const preventDefault = jest.fn();
const wrapper = shallow(<DropArea {...props()} />);
const wrapper = shallow<DropArea>(<DropArea {...props()} />);
expect(wrapper.instance().state.isHovered).toEqual(false);
wrapper.simulate("dragEnter", { preventDefault });
expect(preventDefault).toHaveBeenCalled();
@ -39,7 +39,7 @@ describe("<DropArea />", () => {
});
it("handles drag leave", () => {
const wrapper = shallow(<DropArea {...props()} />);
const wrapper = shallow<DropArea>(<DropArea {...props()} />);
wrapper.setState({ isHovered: true });
wrapper.simulate("dragLeave");
expect(wrapper.instance().state.isHovered).toEqual(false);
@ -47,7 +47,7 @@ describe("<DropArea />", () => {
it("handles drag over", () => {
const preventDefault = jest.fn();
const wrapper = shallow(<DropArea {...props()} />);
const wrapper = shallow<DropArea>(<DropArea {...props()} />);
expect(wrapper.instance().state.isHovered).toEqual(false);
wrapper.simulate("dragOver", { preventDefault });
expect(preventDefault).toHaveBeenCalled();
@ -57,7 +57,7 @@ describe("<DropArea />", () => {
it("handles drop", () => {
const preventDefault = jest.fn();
const p = props();
const wrapper = shallow(<DropArea {...p} />);
const wrapper = shallow<DropArea>(<DropArea {...p} />);
expect(wrapper.instance().state.isHovered).toEqual(false);
wrapper.simulate("drop", {
preventDefault, dataTransfer: {

View file

@ -5,7 +5,7 @@ import { FallbackWidget } from "../fallback_widget";
describe("<FallbackWidget/>", function () {
it("renders widget fallback", function () {
const wrapper =mount<>(<FallbackWidget title="FakeWidget" />);
const wrapper = mount<{}>(<FallbackWidget title="FakeWidget" />);
const widget = wrapper.find(".widget-wrapper");
const header = widget.find(".widget-header");
expect(header.text()).toContain("FakeWidget");

View file

@ -64,7 +64,7 @@ describe("<FarmDesigner/>", () => {
it("loads default map settings", () => {
localStorage["showPoints"] = "false";
const wrapper =mount<>(<FarmDesigner {...fakeProps()} />);
const wrapper = mount<{}>(<FarmDesigner {...fakeProps()} />);
const legendProps = wrapper.find("GardenMapLegend").props() as GardenMapLegendProps;
expect(legendProps.legendMenuOpen).toBeFalsy();
expect(legendProps.showPlants).toBeTruthy();
@ -87,7 +87,7 @@ describe("<FarmDesigner/>", () => {
image1.body.created_at = "2001-01-03T00:00:00.000Z";
image2.body.created_at = "2001-01-01T00:00:00.000Z";
p.latestImages = [image1, image2];
const wrapper =mount<>(<FarmDesigner {...p} />);
const wrapper = mount<{}>(<FarmDesigner {...p} />);
const legendProps = wrapper.find("GardenMapLegend").props() as GardenMapLegendProps;
expect(legendProps.imageAgeInfo)
.toEqual({ newestDate: "2001-01-03T00:00:00.000Z", toOldest: 2 });
@ -95,7 +95,7 @@ describe("<FarmDesigner/>", () => {
it("renders nav titles", () => {
mockPath = "/app/designer/plants";
const wrapper =mount<>(<FarmDesigner {...fakeProps()} />);
const wrapper = mount<{}>(<FarmDesigner {...fakeProps()} />);
["Map", "Plants", "Farm Events"].map(string =>
expect(wrapper.text()).toContain(string));
expect(wrapper.find(".panel-header").first().hasClass("hidden")).toBeTruthy();
@ -105,7 +105,7 @@ describe("<FarmDesigner/>", () => {
it("hides panel", () => {
mockPath = "/app/designer";
const wrapper =mount<>(<FarmDesigner {...fakeProps()} />);
const wrapper = mount<{}>(<FarmDesigner {...fakeProps()} />);
["Map", "Plants", "Farm Events"].map(string =>
expect(wrapper.text()).toContain(string));
expect(wrapper.find(".panel-header").first().hasClass("hidden")).toBeFalsy();

View file

@ -39,7 +39,7 @@ describe("<AddFarmEvent />", () => {
}
it("renders", () => {
const wrapper =mount<>(<AddFarmEvent {...fakeProps()} />);
const wrapper = mount<{}>(<AddFarmEvent {...fakeProps()} />);
wrapper.setState({ uuid: "FarmEvent" });
["Add Farm Event", "Sequence or Regimen", "fake", "Save"].map(string =>
expect(wrapper.text()).toContain(string));
@ -49,7 +49,7 @@ describe("<AddFarmEvent />", () => {
});
it("redirects", () => {
const wrapper =mount<>(<AddFarmEvent {...fakeProps()} />);
const wrapper = mount<{}>(<AddFarmEvent {...fakeProps()} />);
expect(wrapper.text()).toContain("Loading");
});
@ -63,7 +63,7 @@ describe("<AddFarmEvent />", () => {
it("cleans up when unmounting", () => {
const props = fakeProps();
const wrapper =mount<>(<AddFarmEvent {...props} />);
const wrapper = mount<{}>(<AddFarmEvent {...props} />);
wrapper.update();
const uuid: string = wrapper.state("uuid");
props.farmEvents[0].uuid = uuid;

View file

@ -37,7 +37,7 @@ describe("<EditFarmEvent />", () => {
}
it("renders", () => {
const wrapper =mount<>(<EditFarmEvent {...fakeProps()} />);
const wrapper = mount<{}>(<EditFarmEvent {...fakeProps()} />);
["Edit Farm Event", "Sequence or Regimen", "fake", "Save"]
.map(string => expect(wrapper.text()).toContain(string));
const deleteBtn = wrapper.find("button").last();
@ -48,7 +48,7 @@ describe("<EditFarmEvent />", () => {
it("redirects", () => {
const p = fakeProps();
p.getFarmEvent = jest.fn();
const wrapper =mount<>(<EditFarmEvent {...p} />);
const wrapper = mount<{}>(<EditFarmEvent {...p} />);
expect(wrapper.text()).toContain("Loading");
});
});

View file

@ -42,7 +42,7 @@ describe("<FarmEventForm/>", () => {
});
function instance(p: EditFEProps) {
returnmount<>(<EditFEForm {...p} />).instance() as EditFEForm;
return mount<{}>(<EditFEForm {...p} />).instance() as EditFEForm;
}
const context = { form: new EditFEForm(props()) };
@ -196,7 +196,7 @@ describe("<FarmEventForm/>", () => {
const seq = fakeSequence();
const fe = fakeFarmEvent("Sequence", seq.body.id || 0);
fe.specialStatus = SpecialStatus.DIRTY;
const el =mount<>(<EditFEForm
const el = mount<{}>(<EditFEForm
farmEvent={fe}
title=""
deviceTimezone="America/Chicago"

View file

@ -17,7 +17,7 @@ describe("<DrawnPoint/>", () => {
}
it("renders point", () => {
const wrapper =mount<>(<DrawnPoint {...fakeProps()} />);
const wrapper = mount<{}>(<DrawnPoint {...fakeProps()} />);
expect(wrapper.find("g").props().stroke).toEqual("red");
expect(wrapper.find("circle").first().props()).toEqual({
id: "point-radius", strokeDasharray: "4 5",

View file

@ -158,7 +158,7 @@ describe("<GardenPlant/>", () => {
it("ends drag", () => {
const p = fakeProps();
const wrapper = shallow(<GardenMap {...p} />);
const wrapper = shallow<GardenMap>(<GardenMap {...p} />);
expect(wrapper.state()).toEqual({});
wrapper.find("#drop-area-svg").simulate("mouseUp");
expect(p.dispatch).not.toHaveBeenCalled();

View file

@ -49,11 +49,11 @@ describe("<ImageFilterMenu />", () => {
i: number) => {
it(`sets filter: ${filter}`, () => {
const p = fakeProps();
const wrapper = shallow(<ImageFilterMenu {...p} />);
const wrapper = shallow<ImageFilterMenu>(<ImageFilterMenu {...p} />);
wrapper.find("BlurableInput").at(i).simulate("commit", {
currentTarget: { value: "2001-01-03" }
});
expect(wrapper.state()[filter]).toEqual("2001-01-03");
expect(wrapper.instance().state[filter]).toEqual("2001-01-03");
expect(setWebAppConfigValue)
.toHaveBeenCalledWith(key, "2001-01-03T00:00:00.000Z");
});
@ -68,12 +68,12 @@ describe("<ImageFilterMenu />", () => {
i: number) => {
it(`sets filter: ${filter}`, () => {
const p = fakeProps();
const wrapper = shallow(<ImageFilterMenu {...p} />);
const wrapper = shallow<ImageFilterMenu>(<ImageFilterMenu {...p} />);
wrapper.setState({ beginDate: "2001-01-03", endDate: "2001-01-03" });
wrapper.find("BlurableInput").at(i).simulate("commit", {
currentTarget: { value: "05:00" }
});
expect(wrapper.state()[filter]).toEqual("05:00");
expect(wrapper.instance().state[filter]).toEqual("05:00");
expect(setWebAppConfigValue)
.toHaveBeenCalledWith(key, "2001-01-03T05:00:00.000Z");
});
@ -95,7 +95,7 @@ describe("<ImageFilterMenu />", () => {
it("changes slider", () => {
const p = fakeProps();
p.imageAgeInfo.newestDate = "2001-01-03T05:00:00.000Z";
const wrapper = shallow(<ImageFilterMenu {...p} />);
const wrapper = shallow<ImageFilterMenu>(<ImageFilterMenu {...p} />);
wrapper.find("Slider").simulate("change", 1);
expect(wrapper.instance().state.slider).toEqual(1);
expect(setWebAppConfigValue)
@ -107,7 +107,7 @@ describe("<ImageFilterMenu />", () => {
it("displays slider labels", () => {
const p = fakeProps();
p.imageAgeInfo.newestDate = "2001-01-03T00:00:00.000Z";
const wrapper =mount<>(<ImageFilterMenu {...p} />);
const wrapper = mount<{}>(<ImageFilterMenu {...p} />);
["Jan-1", "Jan-2", "Jan-3"].map(date =>
expect(wrapper.text()).toContain(date));
});

View file

@ -35,7 +35,7 @@ describe("<MapImage />", () => {
};
it("doesn't render image", () => {
const wrapper =mount<>(<MapImage {...fakeProps()} />);
const wrapper = mount<{}>(<MapImage {...fakeProps()} />);
expect(wrapper.html()).toEqual("<image></image>");
});
@ -61,7 +61,7 @@ describe("<MapImage />", () => {
expectedData: ExpectedData,
extra?: ExtraTranslationData) => {
it(`renders image: INPUT_SET_${num}`, () => {
const wrapper =mount<>(<MapImage {...inputData[num]} />);
const wrapper = mount<{}>(<MapImage {...inputData[num]} />);
expect(wrapper.find("image").props()).toEqual({
xlinkHref: "image_url",
x: 0,
@ -155,21 +155,21 @@ describe("<MapImage />", () => {
it("doesn't render placeholder image", () => {
const p = INPUT_SET_1;
p.image && (p.image.body.attachment_url = "/placehold.");
const wrapper =mount<>(<MapImage {...p} />);
const wrapper = mount<{}>(<MapImage {...p} />);
expect(wrapper.html()).toEqual("<image></image>");
});
it("doesn't render image taken at different height than calibration", () => {
const p = INPUT_SET_1;
p.image && (p.image.body.meta.z = 100);
const wrapper =mount<>(<MapImage {...p} />);
const wrapper = mount<{}>(<MapImage {...p} />);
expect(wrapper.html()).toEqual("<image></image>");
});
it("doesn't render images that are not adjusted for camera rotation", () => {
const p = INPUT_SET_1;
p.image && (p.image.body.meta.name = "na");
const wrapper =mount<>(<MapImage {...p} />);
const wrapper = mount<{}>(<MapImage {...p} />);
expect(wrapper.html()).toEqual("<image></image>");
});
});

View file

@ -29,7 +29,7 @@ describe("<ToolbaySlot />", () => {
p.pulloutDirection = direction;
p.quadrant = quadrant;
p.xySwap = xySwap;
const wrapper =mount<>(<ToolbaySlot {...p} />);
const wrapper = mount<{}>(<ToolbaySlot {...p} />);
expect(wrapper.find("use").props().transform).toEqual(expected);
});
};
@ -76,7 +76,7 @@ describe("<Tool/>", () => {
};
it("renders standard tool styling", () => {
const wrapper =mount<>(<Tool {...fakeProps()} />);
const wrapper = mount<{}>(<Tool {...fakeProps()} />);
const props = wrapper.find("circle").last().props();
expect(props.r).toEqual(35);
expect(props.cx).toEqual(10);
@ -87,7 +87,7 @@ describe("<Tool/>", () => {
it("tool hover", () => {
const p = fakeProps();
p.toolProps.hovered = true;
const wrapper =mount<>(<Tool {...p} />);
const wrapper = mount<{}>(<Tool {...p} />);
const props = wrapper.find("circle").last().props();
expect(props.fill).toEqual(Color.darkGray);
});
@ -95,7 +95,7 @@ describe("<Tool/>", () => {
it("renders special tool styling: bin", () => {
const p = fakeProps();
p.tool = "seedBin";
const wrapper =mount<>(<Tool {...p} />);
const wrapper = mount<{}>(<Tool {...p} />);
const elements = wrapper.find("#seed-bin").find("circle");
expect(elements.length).toEqual(2);
expect(elements.last().props().fill).toEqual("url(#SeedBinGradient)");
@ -105,7 +105,7 @@ describe("<Tool/>", () => {
const p = fakeProps();
p.tool = "seedBin";
p.toolProps.hovered = true;
const wrapper =mount<>(<Tool {...p} />);
const wrapper = mount<{}>(<Tool {...p} />);
p.toolProps.hovered = true;
expect(wrapper.find("#seed-bin").find("circle").length).toEqual(3);
});
@ -113,7 +113,7 @@ describe("<Tool/>", () => {
it("renders special tool styling: tray", () => {
const p = fakeProps();
p.tool = "seedTray";
const wrapper =mount<>(<Tool {...p} />);
const wrapper = mount<{}>(<Tool {...p} />);
const elements = wrapper.find("#seed-tray");
expect(elements.find("circle").length).toEqual(2);
expect(elements.find("rect").length).toEqual(1);
@ -124,7 +124,7 @@ describe("<Tool/>", () => {
const p = fakeProps();
p.tool = "seedTray";
p.toolProps.hovered = true;
const wrapper =mount<>(<Tool {...p} />);
const wrapper = mount<{}>(<Tool {...p} />);
p.toolProps.hovered = true;
expect(wrapper.find("#seed-tray").find("circle").length).toEqual(3);
});

View file

@ -18,7 +18,7 @@ describe("<ToolSlotPoint/>", () => {
const p = fakeProps();
if (!tool) { p.slot.tool = undefined; }
p.slot.toolSlot.body.pullout_direction = slot;
const wrapper =mount<>(<ToolSlotPoint {...p} />);
const wrapper = mount<{}>(<ToolSlotPoint {...p} />);
expect(wrapper.find("circle").length).toEqual(tool);
expect(wrapper.find("use").length).toEqual(slot);
});
@ -31,7 +31,7 @@ describe("<ToolSlotPoint/>", () => {
it("displays tool name", () => {
const p = fakeProps();
p.slot.toolSlot.body.pullout_direction = 2;
const wrapper =mount<>(<ToolSlotPoint {...p} />);
const wrapper = mount<{}>(<ToolSlotPoint {...p} />);
wrapper.setState({ hovered: true });
expect(wrapper.find("text").props().visibility).toEqual("visible");
expect(wrapper.find("text").text()).toEqual("Foo");
@ -41,28 +41,28 @@ describe("<ToolSlotPoint/>", () => {
it("displays 'no tool'", () => {
const p = fakeProps();
p.slot.tool = undefined;
const wrapper =mount<>(<ToolSlotPoint {...p} />);
const wrapper = mount<{}>(<ToolSlotPoint {...p} />);
wrapper.setState({ hovered: true });
expect(wrapper.find("text").text()).toEqual("no tool");
expect(wrapper.find("text").props().dx).toEqual(40);
});
it("doesn't display tool name", () => {
const wrapper =mount<>(<ToolSlotPoint {...fakeProps()} />);
const wrapper = mount<{}>(<ToolSlotPoint {...fakeProps()} />);
expect(wrapper.find("text").props().visibility).toEqual("hidden");
});
it("renders bin", () => {
const p = fakeProps();
if (p.slot.tool) { p.slot.tool.body.name = "seed bin"; }
const wrapper =mount<>(<ToolSlotPoint {...p} />);
const wrapper = mount<{}>(<ToolSlotPoint {...p} />);
expect(wrapper.find("#SeedBinGradient").length).toEqual(1);
});
it("renders tray", () => {
const p = fakeProps();
if (p.slot.tool) { p.slot.tool.body.name = "seed tray"; }
const wrapper =mount<>(<ToolSlotPoint {...p} />);
const wrapper = mount<{}>(<ToolSlotPoint {...p} />);
expect(wrapper.find("#SeedTrayPattern").length).toEqual(1);
});
});

View file

@ -34,7 +34,7 @@ describe("<Bugs />", () => {
it("kills bugs", () => {
setEggStatus(EggKeys.BUGS_ARE_STILL_ALIVE, "");
expectAlive("");
const wrapper =mount<>(<Bugs {...fakeProps()} />);
const wrapper = mount<Bugs>(<Bugs {...fakeProps()} />);
wrapper.instance().state.bugs[0].r = 101;
range(10).map(b =>
wrapper.find("image").at(b).simulate("click"));

View file

@ -26,7 +26,7 @@ describe("<BotFigure/>", () => {
p.mapTransformProps.quadrant = quadrant;
p.mapTransformProps.xySwap = xySwap;
p.name = name;
const result = shallow(<BotFigure {...p} />);
const result = shallow<BotFigure>(<BotFigure {...p} />);
const expectedGantryProps = expect.objectContaining({
id: "gantry",
@ -67,7 +67,7 @@ describe("<BotFigure/>", () => {
const p = fakeProps();
p.mapTransformProps.quadrant = 2;
p.position = { x: 100, y: 200, z: 0 };
const result = shallow(<BotFigure {...p} />);
const result = shallow<BotFigure>(<BotFigure {...p} />);
const gantry = result.find("#gantry");
expect(gantry.length).toEqual(1);
expect(gantry.props().x).toEqual(90);
@ -79,14 +79,14 @@ describe("<BotFigure/>", () => {
it("changes color on e-stop", () => {
const p = fakeProps();
p.eStopStatus = true;
const wrapper = shallow(<BotFigure {...p} />);
const wrapper = shallow<BotFigure>(<BotFigure {...p} />);
expect(wrapper.find("#gantry").props().fill).toEqual(Color.virtualRed);
});
it("shows coordinates on hover", () => {
const p = fakeProps();
p.position.x = 100;
const wrapper = shallow(<BotFigure {...p} />);
const wrapper = shallow<BotFigure>(<BotFigure {...p} />);
expect(wrapper.instance().state.hovered).toBeFalsy();
const utm = wrapper.find("#UTM");
utm.simulate("mouseOver");
@ -106,7 +106,7 @@ describe("<BotFigure/>", () => {
const p = fakeProps();
p.position.x = 100;
p.mapTransformProps.xySwap = true;
const wrapper = shallow(<BotFigure {...p} />);
const wrapper = shallow<BotFigure>(<BotFigure {...p} />);
const utm = wrapper.find("#UTM");
utm.simulate("mouseOver");
expect(wrapper.instance().state.hovered).toBeTruthy();

View file

@ -30,7 +30,7 @@ describe("<AddPlant />", () => {
}]
};
mockPath = "/app/designer/plants/crop_search/mint/add";
const wrapper =mount<>(<AddPlant {...props} />);
const wrapper = mount<{}>(<AddPlant {...props} />);
expect(wrapper.text()).toContain("Mint");
expect(wrapper.text()).toContain("Done");
expect(wrapper.find("img").props().src)

View file

@ -30,13 +30,13 @@ describe("<CreatePoints />", () => {
};
};
it("renders", () => {
const wrapper =mount<>(<CreatePoints {...fakeProps()} />);
const wrapper = mount<{}>(<CreatePoints {...fakeProps()} />);
["create point", "cancel", "delete", "x", "y", "radius", "color"]
.map(string => expect(wrapper.text().toLowerCase()).toContain(string));
});
it("creates point", () => {
const wrapper =mount<>(<CreatePoints {...fakeProps()} />);
const wrapper = mount<{}>(<CreatePoints {...fakeProps()} />);
wrapper.setState({ cx: 10, cy: 20, r: 30, color: "red" });
clickButton(wrapper, 0, "create point");
expect(initSave).toHaveBeenCalledWith({
@ -54,7 +54,7 @@ describe("<CreatePoints />", () => {
it("deletes all points", () => {
const p = fakeProps();
const wrapper =mount<>(<CreatePoints {...p} />);
const wrapper = mount<{}>(<CreatePoints {...p} />);
const button = wrapper.find("button").last();
expect(button.text()).toEqual("Delete all created points");
window.confirm = jest.fn();

View file

@ -45,7 +45,7 @@ describe("<CropInfo />", () => {
it("renders", () => {
mockPath = "/app/designer/plants/crop_search/mint";
const wrapper =mount<>(<CropInfo {...fakeProps()} />);
const wrapper = mount<{}>(<CropInfo {...fakeProps()} />);
expect(wrapper.text()).toContain("Mint");
expect(wrapper.text()).toContain("Drag and drop into map");
expect(wrapper.text()).toContain("Row Spacing1000mm");

View file

@ -31,7 +31,7 @@ describe("<EditPlantInfo />", () => {
};
it("renders", async () => {
const wrapper =mount<>(<EditPlantInfo {...fakeProps()} />);
const wrapper = mount<{}>(<EditPlantInfo {...fakeProps()} />);
expect(wrapper.text()).toContain("Strawberry Plant 1");
expect(wrapper.text().replace(/\s+/g, " "))
.toContain("Plant Type: Strawberry");
@ -40,7 +40,7 @@ describe("<EditPlantInfo />", () => {
it("deletes plant", async () => {
const p = fakeProps();
p.dispatch = jest.fn(() => { return Promise.resolve(); });
const wrapper =mount<>(<EditPlantInfo {...p} />);
const wrapper = mount<{}>(<EditPlantInfo {...p} />);
const deleteButton = wrapper.find("button").at(2);
expect(deleteButton.text()).toEqual("Delete");
expect(deleteButton.props().hidden).toBeFalsy();

View file

@ -34,7 +34,7 @@ describe("<MoveTo />", () => {
}
it("moves to location: bot's current z value", () => {
const wrapper =mount<>(<MoveTo {...fakeProps()} />);
const wrapper = mount<{}>(<MoveTo {...fakeProps()} />);
wrapper.find("button").simulate("click");
expect(mockDevice.moveAbsolute).toHaveBeenCalledWith({ x: 1, y: 2, z: 30 });
});
@ -49,7 +49,7 @@ describe("<MoveToForm />", () => {
}
it("moves to location: custom z value", () => {
const wrapper =mount<>(<MoveToForm {...fakeProps()} />);
const wrapper = mount<{}>(<MoveToForm {...fakeProps()} />);
wrapper.setState({ z: 50 });
wrapper.find("button").simulate("click");
expect(mockDevice.moveAbsolute).toHaveBeenCalledWith({ x: 1, y: 2, z: 50 });

View file

@ -22,7 +22,7 @@ describe("<OpenFarmResults/>", () => {
},
]
};
const el =mount<>(<OpenFarmResults {...props} />);
const el = mount<{}>(<OpenFarmResults {...props} />);
const text = el.text();
expect(text).toContain(props.cropSearchResults[0].crop.name);
expect(text).toContain(props.cropSearchResults[1].crop.name);

View file

@ -36,14 +36,14 @@ describe("<SelectPlants />", () => {
}
it("displays selected plant", () => {
const wrapper =mount<>(<SelectPlants {...fakeProps()} />);
const wrapper = mount<{}>(<SelectPlants {...fakeProps()} />);
expect(wrapper.text()).toContain("Strawberry");
});
it("displays multiple selected plants", () => {
const p = fakeProps();
p.selected = ["plant.1", "plant.2"];
const wrapper =mount<>(<SelectPlants {...p} />);
const wrapper = mount<{}>(<SelectPlants {...p} />);
["Strawberry", "Blueberry", "Delete"].map(string =>
expect(wrapper.text()).toContain(string));
});
@ -51,21 +51,21 @@ describe("<SelectPlants />", () => {
it("displays no selected plants: selection empty", () => {
const p = fakeProps();
p.selected = [];
const wrapper =mount<>(<SelectPlants {...p} />);
const wrapper = mount<{}>(<SelectPlants {...p} />);
expect(wrapper.text()).not.toContain("Strawberry Plant");
});
it("displays no selected plants: selection invalid", () => {
const p = fakeProps();
p.selected = ["not a uuid"];
const wrapper =mount<>(<SelectPlants {...p} />);
const wrapper = mount<{}>(<SelectPlants {...p} />);
expect(wrapper.text()).not.toContain("Strawberry Plant");
});
it("selects all", () => {
const p = fakeProps();
p.dispatch = jest.fn();
const wrapper =mount<>(<SelectPlants {...p} />);
const wrapper = mount<{}>(<SelectPlants {...p} />);
clickButton(wrapper, 1, "select all");
expect(p.dispatch).toHaveBeenCalledWith(
{ payload: ["plant.1", "plant.2"], type: Actions.SELECT_PLANT });
@ -74,7 +74,7 @@ describe("<SelectPlants />", () => {
it("selects none", () => {
const p = fakeProps();
p.dispatch = jest.fn();
const wrapper =mount<>(<SelectPlants {...p} />);
const wrapper = mount<{}>(<SelectPlants {...p} />);
clickButton(wrapper, 2, "select none");
expect(p.dispatch).toHaveBeenCalledWith(
{ payload: undefined, type: Actions.SELECT_PLANT });
@ -83,7 +83,7 @@ describe("<SelectPlants />", () => {
it("confirms deletion of selected plants", () => {
const p = fakeProps();
p.selected = ["plant.1", "plant.2"];
const wrapper =mount<>(<SelectPlants {...p} />);
const wrapper = mount<{}>(<SelectPlants {...p} />);
expect(wrapper.text()).toContain("Delete");
window.confirm = jest.fn();
wrapper.find("button").first().simulate("click");

View file

@ -35,7 +35,7 @@ describe("<FarmwareConfigMenu />", () => {
}
it("calls install 1st party farmwares", () => {
const wrapper =mount<>(<FarmwareConfigMenu {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwareConfigMenu {...fakeProps()} />);
const button = wrapper.find("button").first();
expect(button.hasClass("fa-download")).toBeTruthy();
button.simulate("click");

View file

@ -60,7 +60,7 @@ describe("<ConfigFields />", () => {
it("renders fields", () => {
const p = fakeProps();
p.farmware.config.push({ name: "config_2", label: "Config 2", value: "2" });
const wrapper =mount<>(<ConfigFields {...fakeProps()} />);
const wrapper = mount<{}>(<ConfigFields {...fakeProps()} />);
expect(wrapper.text()).toEqual("Config 1");
});
@ -84,7 +84,7 @@ describe("<FarmwareForm />", () => {
};
it("renders form", () => {
const wrapper =mount<>(<FarmwareForm {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwareForm {...fakeProps()} />);
["Run", "Config 1"].map(string =>
expect(wrapper.text()).toContain(string));
expect(wrapper.find("label").last().text()).toContain("Config 1");
@ -94,12 +94,12 @@ describe("<FarmwareForm />", () => {
it("renders no fields", () => {
const p = fakeProps();
p.farmware.config = [];
const wrapper =mount<>(<FarmwareForm {...p} />);
const wrapper = mount<{}>(<FarmwareForm {...p} />);
expect(wrapper.text()).toEqual("Run");
});
it("runs farmware", () => {
const wrapper =mount<>(<FarmwareForm {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwareForm {...fakeProps()} />);
clickButton(wrapper, 0, "run");
expect(mockDevice.execScript).toHaveBeenCalledWith(
"My Fake Farmware", [{

View file

@ -29,12 +29,12 @@ describe("<FarmwareInfo />", () => {
it("renders no manifest info message", () => {
const p = fakeProps();
p.farmware = undefined;
const wrapper =mount<>(<FarmwareInfo {...p} />);
const wrapper = mount<{}>(<FarmwareInfo {...p} />);
expect(wrapper.text()).toEqual("Not available when device is offline.");
});
it("renders info", () => {
const wrapper =mount<>(<FarmwareInfo {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwareInfo {...fakeProps()} />);
["Description", "Version", "Language", "Author", "Manage"].map(string =>
expect(wrapper.text()).toContain(string));
expect(wrapper.text()).toContain("Does things.");
@ -44,18 +44,18 @@ describe("<FarmwareInfo />", () => {
const p = fakeProps();
p.farmware = fakeFarmware();
p.farmware.meta.author = "Farmbot.io";
const wrapper =mount<>(<FarmwareInfo {...p} />);
const wrapper = mount<{}>(<FarmwareInfo {...p} />);
expect(wrapper.text()).toContain("FarmBot, Inc.");
});
it("updates Farmware", () => {
const wrapper =mount<>(<FarmwareInfo {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwareInfo {...fakeProps()} />);
clickButton(wrapper, 0, "Update");
expect(mockDevice.updateFarmware).toHaveBeenCalledWith("My Fake Farmware");
});
it("removes Farmware", () => {
const wrapper =mount<>(<FarmwareInfo {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwareInfo {...fakeProps()} />);
clickButton(wrapper, 1, "Remove");
expect(mockDevice.removeFarmware).toHaveBeenCalledWith("My Fake Farmware");
});
@ -65,7 +65,7 @@ describe("<FarmwareInfo />", () => {
p.farmware = fakeFarmware();
p.farmware.name = "Fake 1st-Party Farmware";
p.firstPartyFarmwareNames = ["Fake 1st-Party Farmware"];
const wrapper =mount<>(<FarmwareInfo {...p} />);
const wrapper = mount<{}>(<FarmwareInfo {...p} />);
clickButton(wrapper, 1, "Remove");
expect(mockDevice.removeFarmware).not.toHaveBeenCalled();
});
@ -75,7 +75,7 @@ describe("<FarmwareInfo />", () => {
p.farmware = fakeFarmware();
p.farmware.name = "Fake 1st-Party Farmware";
p.firstPartyFarmwareNames = ["Fake 1st-Party Farmware"];
const wrapper =mount<>(<FarmwareInfo {...p} />);
const wrapper = mount<{}>(<FarmwareInfo {...p} />);
window.confirm = jest.fn(() => true);
clickButton(wrapper, 1, "Remove");
expect(window.confirm).toHaveBeenCalledWith(

View file

@ -25,7 +25,7 @@ describe("<FarmwareList />", () => {
};
it("renders", () => {
const wrapper =mount<>(<FarmwareList {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwareList {...fakeProps()} />);
["Photos",
"Camera Calibration",
"Weed Detector",
@ -62,7 +62,7 @@ describe("<FarmwareList />", () => {
it("installs a new farmware", () => {
const p = fakeProps();
const wrapper =mount<>(<FarmwareList {...p} />);
const wrapper = mount<{}>(<FarmwareList {...p} />);
wrapper.setState({ packageUrl: FAKE_INSTALL_URL });
window.alert = jest.fn();
clickButton(wrapper, 0, "Install");
@ -77,7 +77,7 @@ describe("<FarmwareList />", () => {
p.farmwares["farmware_1"] = farmware;
p.firstPartyFarmwareNames = ["Fake First-Party Farmware"];
p.showFirstParty = false;
const wrapper =mount<>(<FarmwareList {...p} />);
const wrapper = mount<{}>(<FarmwareList {...p} />);
expect(wrapper.text()).not.toContain("Fake First-Party Farmware");
});
@ -88,7 +88,7 @@ describe("<FarmwareList />", () => {
p.farmwares["farmware_1"] = farmware;
p.firstPartyFarmwareNames = ["Fake First-Party Farmware"];
p.showFirstParty = true;
const wrapper =mount<>(<FarmwareList {...p} />);
const wrapper = mount<{}>(<FarmwareList {...p} />);
expect(wrapper.text()).toContain("Fake First-Party Farmware");
});

View file

@ -49,13 +49,13 @@ describe("<FarmwarePage />", () => {
};
it("renders panels", () => {
const wrapper =mount<>(<FarmwarePage {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwarePage {...fakeProps()} />);
["Farmware", "My Farmware"].map(string =>
expect(wrapper.text()).toContain(string));
});
it("renders photos page by default", () => {
const wrapper =mount<>(<FarmwarePage {...fakeProps()} />);
const wrapper = mount<{}>(<FarmwarePage {...fakeProps()} />);
expect(wrapper.text()).toContain("Take Photo");
});
@ -72,7 +72,7 @@ describe("<FarmwarePage />", () => {
it(`renders ${farmware} Farmware page`, () => {
const p = fakeProps();
p.currentFarmware = farmware;
const wrapper =mount<>(<FarmwarePage {...p} />);
const wrapper = mount<{}>(<FarmwarePage {...p} />);
expectedText.map(string =>
expect(wrapper.text()).toContain(string));
})
@ -81,7 +81,7 @@ describe("<FarmwarePage />", () => {
const p = fakeProps();
p.farmwares["My Fake Farmware"] = fakeFarmware();
p.currentFarmware = "My Fake Farmware";
const wrapper =mount<>(<FarmwarePage {...p} />);
const wrapper = mount<{}>(<FarmwarePage {...p} />);
["My Fake Farmware", "Does things", "Run", "Config 1",
"Information", "Description", "Version", "Update", "Remove"
].map(string =>
@ -94,7 +94,7 @@ describe("<FarmwarePage />", () => {
farmware.config = [];
p.farmwares["My Fake Farmware"] = farmware;
p.currentFarmware = "My Fake Farmware";
const wrapper =mount<>(<FarmwarePage {...p} />);
const wrapper = mount<{}>(<FarmwarePage {...p} />);
["My Fake Farmware", "Does things", "Run", "No inputs provided."
].map(string =>
expect(wrapper.text()).toContain(string));
@ -106,7 +106,7 @@ describe("<FarmwarePage />", () => {
farmware.config = [];
p.farmwares["My Fake Farmware"] = farmware;
p.currentFarmware = "My Fake Farmware";
const wrapper =mount<>(<FarmwarePage {...p} />);
const wrapper = mount<{}>(<FarmwarePage {...p} />);
clickButton(wrapper, 1, "Run");
expect(mockDevice.execScript).toHaveBeenCalledWith("My Fake Farmware");
});

View file

@ -31,7 +31,7 @@ describe("<CameraCalibration/>", () => {
};
it("renders", () => {
const wrapper =mount<>(<CameraCalibration {...props} />);
const wrapper = mount<{}>(<CameraCalibration {...props} />);
["Color Range",
"HUE017947",
"SATURATION025558",

View file

@ -118,7 +118,7 @@ describe("<ImageFlipper/>", () => {
const images = prepareImages(fakeImages);
const currentImage = images[1];
const props = { images, currentImage, onFlip };
const wrapper =mount<>(<ImageFlipper {...props} />);
const wrapper = mount<{}>(<ImageFlipper {...props} />);
const prevButton = wrapper.find("button").first();
expect(prevButton.text().toLowerCase()).toBe("prev");
expect(prevButton.props().disabled).toBeFalsy();

View file

@ -33,7 +33,7 @@ describe("<Photos/>", () => {
const images = prepareImages(fakeImages);
const currentImage = images[1];
const props = { images, currentImage, dispatch, timeOffset: 0 };
const wrapper =mount<>(<Photos {...props} />);
const wrapper = mount<{}>(<Photos {...props} />);
expect(wrapper.text()).toContain("Created At:June 1st, 2017");
expect(wrapper.text()).toContain("X:632Y:347Z:164");
});
@ -45,7 +45,7 @@ describe("<Photos/>", () => {
dispatch: jest.fn(),
timeOffset: 0
};
const wrapper =mount<>(<Photos {...props} />);
const wrapper = mount<{}>(<Photos {...props} />);
expect(wrapper.text()).toContain("Image:No meta data.");
});
@ -59,7 +59,7 @@ describe("<Photos/>", () => {
dispatch,
timeOffset: 0
};
const wrapper =mount<>(<Photos {...props} />);
const wrapper = mount<{}>(<Photos {...props} />);
clickButton(wrapper, 1, "delete photo");
expect(destroy).toHaveBeenCalledWith("Position 1");
});

View file

@ -4,7 +4,7 @@ import { WeedDetectorConfig } from "../config"
describe("<WeedDetectorConfig />", () => {
it("renders", () => {
const wrapper =mount<>(<WeedDetectorConfig
const wrapper = mount<{}>(<WeedDetectorConfig
values={{}} onChange={jest.fn()} />);
["Invert Hue Range Selection",
"Calibration Object Separation",

View file

@ -37,7 +37,7 @@ describe("<WeedDetector />", () => {
};
it("renders", () => {
const wrapper =mount<>(<WeedDetector {...props} />);
const wrapper = mount<{}>(<WeedDetector {...props} />);
["Color Range",
"HUE01793090",
"SATURATION025550255",

View file

@ -41,14 +41,14 @@ describe("<FrontPage />", () => {
});
it("shows forgot password box", () => {
const el =mount<>(<FrontPage />);
const el = mount<{}>(<FrontPage />);
expect(el.text()).not.toContain("Reset Password");
el.find("a.forgot-password").first().simulate("click");
expect(el.text()).toContain("Reset Password");
});
it("shows TOS and Privacy links", () => {
const el =mount<>(<FrontPage />);
const el = mount<{}>(<FrontPage />);
["Privacy Policy", "Terms of Use"].map(string =>
expect(el.text()).toContain(string));
["https://farmbot.io/privacy/", "https://farmbot.io/tos/"]
@ -57,7 +57,7 @@ describe("<FrontPage />", () => {
it("submits login: success", async () => {
mockAxiosResponse = Promise.resolve({ data: "new data" });
const el =mount<>(<FrontPage />);
const el = mount<{}>(<FrontPage />);
el.setState({ email: "foo@bar.io", loginPassword: "password" });
// tslint:disable-next-line:no-any
const instance = el.instance() as any;
@ -71,7 +71,7 @@ describe("<FrontPage />", () => {
it("submits login: not verified", async () => {
mockAxiosResponse = Promise.reject({ response: { status: 403 } });
const el =mount<>(<FrontPage />);
const el = mount<{}>(<FrontPage />);
el.setState({ email: "foo@bar.io", loginPassword: "password" });
// tslint:disable-next-line:no-any
const instance = el.instance() as any;
@ -88,7 +88,7 @@ describe("<FrontPage />", () => {
it("submits login: TOS update", async () => {
mockAxiosResponse = Promise.reject({ response: { status: 451 } });
window.location.assign = jest.fn();
const el =mount<>(<FrontPage />);
const el = mount<{}>(<FrontPage />);
el.setState({ email: "foo@bar.io", loginPassword: "password" });
// tslint:disable-next-line:no-any
const instance = el.instance() as any;
@ -102,7 +102,7 @@ describe("<FrontPage />", () => {
});
it("submits registration", () => {
const el =mount<>(<FrontPage />);
const el = mount<{}>(<FrontPage />);
el.setState({
regEmail: "foo@bar.io",
regName: "Foo Bar",
@ -122,7 +122,7 @@ describe("<FrontPage />", () => {
});
it("submits forgot password", () => {
const el =mount<>(<FrontPage />);
const el = mount<{}>(<FrontPage />);
el.setState({ email: "foo@bar.io" });
// tslint:disable-next-line:no-any
const instance = el.instance() as any;
@ -132,7 +132,7 @@ describe("<FrontPage />", () => {
});
it("renders proper panels", () => {
const el =mount<>(<FrontPage />);
const el = mount<{}>(<FrontPage />);
el.setState({ activePanel: "resendVerificationEmail" });
expect(el.text()).toContain("Account Not Verified");
el.setState({ activePanel: "forgotPassword" });

View file

@ -22,7 +22,7 @@ describe("resend_verification.tsx - failure case", () => {
onGoBack: jest.fn(),
email: "foo@bar.com"
};
const el =mount<>(<ResendVerification {...props} />);
const el = mount<{}>(<ResendVerification {...props} />);
expect.assertions(3);
el.find("button").last().simulate("click");
const { calls } = props.no.mock;

View file

@ -23,7 +23,7 @@ describe("resend_verification.tsx - base case", () => {
it("fires the `onGoBack()` callback", () => {
const p = props();
const el =mount<>(<ResendVerification {...p } />);
const el = mount<{}>(<ResendVerification {...p} />);
el.find("button").first().simulate("click");
expect(p.no).not.toHaveBeenCalled();
expect(p.ok).not.toHaveBeenCalled();
@ -32,7 +32,7 @@ describe("resend_verification.tsx - base case", () => {
it("fires the `ok()` callback", (done) => {
const p = props();
const el =mount<>(<ResendVerification {...p } />);
const el = mount<{}>(<ResendVerification {...p} />);
expect.assertions(3);
el.find("button").last().simulate("click");
const { calls } = p.ok.mock;

View file

@ -56,7 +56,7 @@ describe("<Logs />", () => {
};
it("renders", () => {
const wrapper =mount<>(<Logs {...fakeProps()} />);
const wrapper = mount<{}>(<Logs {...fakeProps()} />);
["Logs", ToolTips.LOGS, "Type", "Message", "Time", "Info",
"Fake log message 1", "Success", "Fake log message 2"]
.map(string =>
@ -69,12 +69,12 @@ describe("<Logs />", () => {
it("shows message when logs are loading", () => {
const p = fakeProps();
p.logs[0].body.message = "";
const wrapper =mount<>(<Logs {...p} />);
const wrapper = mount<{}>(<Logs {...p} />);
expect(wrapper.text().toLowerCase()).toContain("loading");
});
it("filters logs", () => {
const wrapper =mount<>(<Logs {...fakeProps()} />);
const wrapper = mount<{}>(<Logs {...fakeProps()} />);
wrapper.setState({ info: 0 });
expect(wrapper.text()).not.toContain("Fake log message 1");
const filterBtn = wrapper.find("button").first();
@ -88,7 +88,7 @@ describe("<Logs />", () => {
const notShownMessage = "This log should not be shown.";
p.logs[0].body.message = notShownMessage;
p.logs[0].body.type = "info";
const wrapper =mount<>(<Logs {...p} />);
const wrapper = mount<{}>(<Logs {...p} />);
wrapper.setState({ info: 0 });
expect(wrapper.text()).not.toContain(notShownMessage);
});
@ -101,7 +101,7 @@ describe("<Logs />", () => {
p.logs[1].body.x = 0;
p.logs[1].body.y = 1;
p.logs[1].body.z = 2;
const wrapper =mount<>(<Logs {...p} />);
const wrapper = mount<{}>(<Logs {...p} />);
expect(wrapper.text()).toContain("Unknown");
expect(wrapper.text()).toContain("0, 1, 2");
});
@ -109,7 +109,7 @@ describe("<Logs />", () => {
it("shows verbosity", () => {
const p = fakeProps();
p.logs[0].body.verbosity = -999;
const wrapper =mount<>(<Logs {...p} />);
const wrapper = mount<{}>(<Logs {...p} />);
expect(wrapper.text()).toContain(-999);
});
@ -120,7 +120,7 @@ describe("<Logs />", () => {
});
it("shows overall filter status", () => {
const wrapper =mount<>(<Logs {...fakeProps()} />);
const wrapper = mount<{}>(<Logs {...fakeProps()} />);
wrapper.setState({
success: 3, busy: 3, warn: 3, error: 3, info: 3, fun: 3, debug: 3
});

View file

@ -21,7 +21,7 @@ describe("<LogsFilterMenu />", () => {
};
it("renders", () => {
const wrapper =mount<>(<LogsFilterMenu {...fakeProps()} />);
const wrapper = mount<{}>(<LogsFilterMenu {...fakeProps()} />);
logTypes.map(string =>
expect(wrapper.text().toLowerCase())
.toContain(string.toLowerCase()));
@ -34,7 +34,7 @@ describe("<LogsFilterMenu />", () => {
const p = fakeProps();
p.toggle = (x) => () => toggle(x);
p.setFilterLevel = (x) => () => setFilterLevel(x);
const wrapper =mount<>(<LogsFilterMenu {...p} />);
const wrapper = mount<{}>(<LogsFilterMenu {...p} />);
wrapper.find("button").at(2).simulate("click");
expect(toggle).toHaveBeenCalledWith("success");
});
@ -42,7 +42,7 @@ describe("<LogsFilterMenu />", () => {
it("shows filter status", () => {
fakeState.debug = 3;
fakeState.success = 0;
const wrapper =mount<>(<LogsFilterMenu {...fakeProps()} />);
const wrapper = mount<{}>(<LogsFilterMenu {...fakeProps()} />);
const toggles = wrapper.find("button");
expect(toggles.last().hasClass("green")).toBeTruthy();
expect(toggles.at(2).hasClass("red")).toBeTruthy();
@ -52,7 +52,7 @@ describe("<LogsFilterMenu />", () => {
const setFilterLevel = jest.fn();
const p = fakeProps();
p.setFilterLevel = (x) => () => setFilterLevel(x);
const wrapper =mount<>(<LogsFilterMenu {...p} />);
const wrapper = mount<{}>(<LogsFilterMenu {...p} />);
clickButton(wrapper, 0, "max");
logTypes.map(logType =>
expect(setFilterLevel).toHaveBeenCalledWith(logType));

View file

@ -52,7 +52,7 @@ describe("<LogsSettingsMenu />", () => {
};
it("renders", () => {
const wrapper =mount<>(<LogsSettingsMenu {...fakeProps() } />);
const wrapper = mount<{}>(<LogsSettingsMenu {...fakeProps() } />);
["begin", "steps", "complete"].map(string =>
expect(wrapper.text().toLowerCase()).toContain(string));
});
@ -60,7 +60,7 @@ describe("<LogsSettingsMenu />", () => {
function testSettingToggle(setting: ConfigurationName, position: number) {
it("toggles setting", () => {
bot.hardware.configuration[setting] = false;
const wrapper =mount<>(<LogsSettingsMenu {...fakeProps() } />);
const wrapper = mount<{}>(<LogsSettingsMenu {...fakeProps() } />);
wrapper.find("button").at(position).simulate("click");
expect(mockDevice.updateConfig)
.toHaveBeenCalledWith({ [setting]: true });
@ -77,7 +77,7 @@ describe("<LogsSettingsMenu />", () => {
const p = fakeProps();
const setFilterLevel = jest.fn();
p.setFilterLevel = () => setFilterLevel;
const wrapper =mount<>(<LogsSettingsMenu {...p} />);
const wrapper = mount<{}>(<LogsSettingsMenu {...p} />);
mockStorj[NumericSetting.busy_log] = 0;
wrapper.find("button").at(0).simulate("click");
expect(setFilterLevel).toHaveBeenCalledWith(2);

View file

@ -4,7 +4,7 @@ import { AdditionalMenu } from "../additional_menu";
describe("AdditionalMenu", () => {
it("renders the account menu", () => {
const wrapper =mount<>(<AdditionalMenu
const wrapper = mount<{}>(<AdditionalMenu
logout={jest.fn()}
close={jest.fn()} />);
const text = wrapper.text();

View file

@ -50,7 +50,7 @@ describe("<TickerList />", () => {
}
it("shows log message and datetime", () => {
const wrapper =mount<>(<TickerList {...fakeProps()} />);
const wrapper = mount<{}>(<TickerList {...fakeProps()} />);
const labels = wrapper.find("label");
expect(labels.length).toEqual(2);
expect(labels.at(0).text()).toContain("Farmbot is up and Running!");
@ -61,7 +61,7 @@ describe("<TickerList />", () => {
it("shows empty log message", () => {
const p = fakeProps();
p.logs = [];
const wrapper =mount<>(<TickerList {...p} />);
const wrapper = mount<{}>(<TickerList {...p} />);
const labels = wrapper.find("label");
expect(labels.length).toEqual(2);
expect(labels.at(0).text()).toContain("No logs yet.");
@ -70,7 +70,7 @@ describe("<TickerList />", () => {
it("shows 'loading' log message", () => {
const p = fakeProps();
p.logs[0].body.message = "";
const wrapper =mount<>(<TickerList {...p} />);
const wrapper = mount<{}>(<TickerList {...p} />);
const labels = wrapper.find("label");
expect(labels.length).toEqual(2);
expect(labels.at(0).text()).toContain("Loading");
@ -79,7 +79,7 @@ describe("<TickerList />", () => {
it("opens ticker", () => {
const p = fakeProps();
p.tickerListOpen = true;
const wrapper =mount<>(<TickerList {...p} />);
const wrapper = mount<{}>(<TickerList {...p} />);
const labels = wrapper.find("label");
expect(labels.length).toEqual(5);
expect(labels.at(0).text()).toContain("Farmbot is up and Running!");
@ -95,7 +95,7 @@ describe("<TickerList />", () => {
.map(logType => mockStorj[logType + "_log"] = 0);
const p = fakeProps();
p.logs[0].body.verbosity = 1;
const wrapper =mount<>(<TickerList {...p} />);
const wrapper = mount<{}>(<TickerList {...p} />);
const labels = wrapper.find("label");
expect(labels.length).toEqual(2);
expect(labels.at(0).text())

View file

@ -16,7 +16,7 @@ describe("<PasswordReset/>", () => {
it("resets the users password", (done) => {
expect.assertions(5);
const el =mount<>(<PasswordReset />);
const el = mount<{}>(<PasswordReset />);
el.setState({
password: "knocknock",
passwordConfirmation: "knocknock",
@ -42,7 +42,7 @@ describe("<PasswordReset/>", () => {
});
it("Has a form set()ter", () => {
const el =mount<>(<PasswordReset />);
const el = mount<{}>(<PasswordReset />);
const i = el.instance() as PasswordReset;
const field = "password";
const value = "password123";

View file

@ -36,7 +36,7 @@ describe("<Regimens />", () => {
}
it("renders", () => {
const wrapper =mount<>(<Regimens {...fakeProps()} />);
const wrapper = mount<{}>(<Regimens {...fakeProps()} />);
["Regimens", "Regimen Editor", "Scheduler"].map(string =>
expect(wrapper.text()).toContain(string));
});
@ -44,7 +44,7 @@ describe("<Regimens />", () => {
it("scheduler is hidden", () => {
const p = fakeProps();
p.current = undefined;
const wrapper =mount<>(<Regimens {...p} />);
const wrapper = mount<{}>(<Regimens {...p} />);
expect(wrapper.text()).not.toContain("Scheduler");
});
});

View file

@ -6,7 +6,7 @@ import { AddButton } from "../add_button";
describe("<AddButton />", () => {
it("renders an add button when active", () => {
const props: AddButtonProps = { active: true, click: jest.fn() };
const wrapper =mount<>(<AddButton {...props} />);
const wrapper = mount<{}>(<AddButton {...props} />);
const button = wrapper.find("button");
["green", "add"].map(klass => {
expect(button.hasClass(klass)).toBeTruthy();
@ -18,7 +18,7 @@ describe("<AddButton />", () => {
it("renders a <div> when inactive", () => {
const props: AddButtonProps = { active: false, click: jest.fn() };
const wrapper =mount<>(<AddButton {...props} />);
const wrapper = mount<{}>(<AddButton {...props} />);
expect(wrapper.html()).toEqual("<div></div>");
});
});

View file

@ -34,7 +34,7 @@ describe("<BulkScheduler />", () => {
}
it("renders with sequence selected", () => {
const wrapper =mount<>(<BulkScheduler {...fakeProps()} />);
const wrapper = mount<{}>(<BulkScheduler {...fakeProps()} />);
const buttons = wrapper.find("button");
expect(buttons.length).toEqual(6);
["Sequence", "Fake Sequence", "Time",
@ -45,7 +45,7 @@ describe("<BulkScheduler />", () => {
it("renders without sequence selected", () => {
const p = fakeProps();
p.selectedSequence = undefined;
const wrapper =mount<>(<BulkScheduler {...p} />);
const wrapper = mount<{}>(<BulkScheduler {...p} />);
["Sequence", "None", "Time"].map(string =>
expect(wrapper.text()).toContain(string));
});

View file

@ -24,7 +24,7 @@ describe("<WeekGrid />", () => {
it("renders", () => {
const props: WeekGridProps = { weeks, dispatch: jest.fn() };
const wrapper =mount<>(<WeekGrid {...props} />);
const wrapper = mount<{}>(<WeekGrid {...props} />);
const buttons = wrapper.find("button");
expect(buttons.length).toEqual(4);
["Days", "Week 1", "1234567"].map(string =>
@ -33,7 +33,7 @@ describe("<WeekGrid />", () => {
function checkAction(position: number, text: string, type: Actions) {
const props: WeekGridProps = { weeks, dispatch: jest.fn() };
const wrapper =mount<>(<WeekGrid {...props} />);
const wrapper = mount<{}>(<WeekGrid {...props} />);
const button = wrapper.find("button").at(position);
expect(button.text().toLowerCase()).toContain(text.toLowerCase());
button.simulate("click");

View file

@ -28,13 +28,13 @@ describe("<ActiveEditor />", () => {
};
it("renders", () => {
const wrapper =mount<>(<ActiveEditor {...props} />);
const wrapper = mount<{}>(<ActiveEditor {...props} />);
["Day", "Item 0", "10:00"].map(string =>
expect(wrapper.text()).toContain(string));
});
it("removes regimen item", () => {
const wrapper =mount<>(<ActiveEditor {...props} />);
const wrapper = mount<{}>(<ActiveEditor {...props} />);
wrapper.find("i").simulate("click");
expect(props.dispatch).toHaveBeenCalledWith({
payload: {

View file

@ -14,7 +14,7 @@ describe("Copy button", () => {
it("Initializes a new regimen on click", () => {
const dispatch = jest.fn();
const regimen = fakeRegimen();
const el =mount<>(<CopyButton dispatch={dispatch} regimen={regimen} />);
const el = mount<{}>(<CopyButton dispatch={dispatch} regimen={regimen} />);
expect(el.find("button").length).toBe(1);
el.simulate("click");
expect(dispatch).toHaveBeenCalledTimes(1);
@ -34,7 +34,7 @@ describe("Copy button", () => {
it("Render a button when given a regimen", () => {
const dispatch = jest.fn();
const regimen = fakeRegimen();
const el =mount<>(<CopyButton dispatch={dispatch} regimen={regimen} />);
const el = mount<{}>(<CopyButton dispatch={dispatch} regimen={regimen} />);
expect(el.find("button").length).toBe(1);
el.simulate("click");
expect(dispatch).toHaveBeenCalledTimes(1);
@ -42,7 +42,7 @@ describe("Copy button", () => {
it("renders nothing if not given a regimen", () => {
const dispatch = jest.fn();
const el =mount<>(<CopyButton dispatch={dispatch} />);
const el = mount<{}>(<CopyButton dispatch={dispatch} />);
expect(el.find("button").length).toBe(0);
el.simulate("click");
expect(dispatch).not.toHaveBeenCalled();

View file

@ -45,7 +45,7 @@ describe("<RegimenEditor />", () => {
}
it("active editor", () => {
const wrapper =mount<>(<RegimenEditor {...fakeProps()} />);
const wrapper = mount<{}>(<RegimenEditor {...fakeProps()} />);
["Delete", "Item 0", "10:00"].map(string =>
expect(wrapper.text()).toContain(string));
});
@ -53,14 +53,14 @@ describe("<RegimenEditor />", () => {
it("empty editor", () => {
const props = fakeProps();
props.current = undefined;
const wrapper =mount<>(<RegimenEditor {...props} />);
const wrapper = mount<{}>(<RegimenEditor {...props} />);
["No Regimen selected."].map(string =>
expect(wrapper.text()).toContain(string));
});
it("deletes regimen", () => {
const p = fakeProps();
const wrapper =mount<>(<RegimenEditor {...p} />);
const wrapper = mount<{}>(<RegimenEditor {...p} />);
clickButton(wrapper, 2, "delete");
const expectedUuid = p.current && p.current.uuid;
expect(destroy).toHaveBeenCalledWith(expectedUuid);
@ -68,7 +68,7 @@ describe("<RegimenEditor />", () => {
it("saves regimen", () => {
const p = fakeProps();
const wrapper =mount<>(<RegimenEditor {...p} />);
const wrapper = mount<{}>(<RegimenEditor {...p} />);
clickButton(wrapper, 0, "save", { partial_match: true });
const expectedUuid = p.current && p.current.uuid;
expect(save).toHaveBeenCalledWith(expectedUuid);

View file

@ -17,7 +17,7 @@ describe("<RegimensList />", () => {
};
}
it("renders", () => {
const wrapper =mount<>(<RegimensList {...fakeProps()} />);
const wrapper = mount<{}>(<RegimensList {...fakeProps()} />);
["Fake Regimen 1", "Fake Regimen 2"]
.map(string => expect(wrapper.text()).toContain(string));
});

View file

@ -59,7 +59,7 @@ describe("<SequenceEditorMiddleActive/>", () => {
}
it("saves", () => {
const wrapper =mount<>(<SequenceEditorMiddleActive {...fakeProps()} />);
const wrapper = mount<{}>(<SequenceEditorMiddleActive {...fakeProps()} />);
clickButton(wrapper, 0, "Save * ");
expect(save).toHaveBeenCalledWith(expect.stringContaining("Sequence"));
});
@ -68,19 +68,19 @@ describe("<SequenceEditorMiddleActive/>", () => {
const p = fakeProps();
p.syncStatus = "synced";
p.sequence.specialStatus = SpecialStatus.SAVED;
const wrapper =mount<>(<SequenceEditorMiddleActive {...p} />);
const wrapper = mount<{}>(<SequenceEditorMiddleActive {...p} />);
clickButton(wrapper, 1, "Test");
expect(execSequence).toHaveBeenCalledWith(p.sequence.body);
});
it("deletes", () => {
const wrapper =mount<>(<SequenceEditorMiddleActive {...fakeProps()} />);
const wrapper = mount<{}>(<SequenceEditorMiddleActive {...fakeProps()} />);
clickButton(wrapper, 2, "Delete");
expect(destroy).toHaveBeenCalledWith(expect.stringContaining("Sequence"));
});
it("copies", () => {
const wrapper =mount<>(<SequenceEditorMiddleActive {...fakeProps()} />);
const wrapper = mount<{}>(<SequenceEditorMiddleActive {...fakeProps()} />);
clickButton(wrapper, 3, "Copy");
expect(copySequence).toHaveBeenCalledWith(expect.objectContaining({
uuid: expect.stringContaining("Sequence")
@ -88,7 +88,7 @@ describe("<SequenceEditorMiddleActive/>", () => {
});
it("has drag area", () => {
const wrapper =mount<>(<SequenceEditorMiddleActive {...fakeProps()} />);
const wrapper = mount<{}>(<SequenceEditorMiddleActive {...fakeProps()} />);
expect(wrapper.find(".drag-drop-area").text()).toEqual("DRAG COMMAND HERE");
});

View file

@ -27,14 +27,14 @@ describe("<SequenceEditorMiddle/>", () => {
}
it("active editor", () => {
const wrapper =mount<>(<SequenceEditorMiddle {...fakeProps()} />);
const wrapper = mount<{}>(<SequenceEditorMiddle {...fakeProps()} />);
expect(wrapper.text()).toContain("Delete");
});
it("inactive editor", () => {
const p = fakeProps();
p.sequence = undefined;
const wrapper =mount<>(<SequenceEditorMiddle {...p} />);
const wrapper = mount<{}>(<SequenceEditorMiddle {...p} />);
expect(wrapper.text()).toContain("No Sequence selected");
});
});

View file

@ -24,7 +24,7 @@ describe("<SequenceSelectBox />", () => {
};
it("renders", () => {
const wrapper =mount<>(<SequenceSelectBox {...fakeProps()} />);
const wrapper = mount<{}>(<SequenceSelectBox {...fakeProps()} />);
expect(wrapper.text()).toEqual("None");
});

Some files were not shown because too many files have changed in this diff Show more