- {!DevSettings.futureFeaturesEnabled() &&
- }
-
;
diff --git a/frontend/farm_designer/points/__tests__/weeds_add_test.tsx b/frontend/farm_designer/points/__tests__/weeds_add_test.tsx
deleted file mode 100644
index b4e78ff3d..000000000
--- a/frontend/farm_designer/points/__tests__/weeds_add_test.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as React from "react";
-import { mount } from "enzyme";
-import {
- RawAddWeed as AddWeed, AddWeedProps, mapStateToProps
-} from "../weeds_add";
-import { fakeState } from "../../../__test_support__/fake_state";
-
-describe("", () => {
- const fakeProps = (): AddWeedProps => ({
- dispatch: jest.fn(),
- });
-
- it("renders", () => {
- const wrapper = mount();
- expect(wrapper.text()).toContain("Add");
- });
-});
-
-describe("mapStateToProps()", () => {
- it("returns props", () => {
- const state = fakeState();
- const props = mapStateToProps(state);
- expect(props.dispatch).toEqual(expect.any(Function));
- });
-});
diff --git a/frontend/farm_designer/points/weeds_add.tsx b/frontend/farm_designer/points/weeds_add.tsx
deleted file mode 100644
index 9c83d0e15..000000000
--- a/frontend/farm_designer/points/weeds_add.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import React from "react";
-import { connect } from "react-redux";
-import {
- DesignerPanel, DesignerPanelContent, DesignerPanelHeader
-} from "../designer_panel";
-import { Everything } from "../../interfaces";
-import { t } from "../../i18next_wrapper";
-import { Panel } from "../panel_header";
-
-export interface AddWeedProps {
- dispatch: Function;
-}
-
-export interface AddWeedState {
-}
-
-export const mapStateToProps = (props: Everything): AddWeedProps => ({
- dispatch: props.dispatch,
-});
-
-export class RawAddWeed extends React.Component {
- state: AddWeedState = {};
- render() {
- return
-
-
-
- ;
- }
-}
-
-export const AddWeed = connect(mapStateToProps)(RawAddWeed);
diff --git a/frontend/farm_designer/saved_gardens/__tests__/saved_gardens_test.tsx b/frontend/farm_designer/saved_gardens/__tests__/saved_gardens_test.tsx
index d35487d6d..4fbbb5476 100644
--- a/frontend/farm_designer/saved_gardens/__tests__/saved_gardens_test.tsx
+++ b/frontend/farm_designer/saved_gardens/__tests__/saved_gardens_test.tsx
@@ -13,17 +13,10 @@ jest.mock("../../../history", () => ({
jest.mock("../../../api/crud", () => ({ edit: jest.fn() }));
-let mockDev = false;
-jest.mock("../../../account/dev/dev_support", () => ({
- DevSettings: {
- futureFeaturesEnabled: () => mockDev,
- }
-}));
-
import * as React from "react";
import { mount, shallow } from "enzyme";
import {
- RawSavedGardens as SavedGardens, mapStateToProps, SavedGardensLink,
+ RawSavedGardens as SavedGardens, mapStateToProps,
SavedGardenHUD, savedGardenOpen,
} from "../saved_gardens";
import { clickButton } from "../../../__test_support__/helpers";
@@ -106,25 +99,6 @@ describe("mapStateToProps()", () => {
});
});
-describe("", () => {
- it("opens saved garden panel", () => {
- mockDev = true;
- const wrapper = shallow();
- clickButton(wrapper, 0, "saved gardens");
- expect(history.push).toHaveBeenCalledWith(
- "/app/designer/gardens");
- mockDev = false;
- });
-
- it("saved garden button hidden", () => {
- mockDev = false;
- const wrapper = shallow();
- const btn = wrapper.find("button").at(0);
- expect(btn.props().hidden).toEqual(true);
- mockDev = false;
- });
-});
-
describe("savedGardenOpen", () => {
it("is open", () => {
const result = savedGardenOpen(["", "", "", "gardens", "4", ""]);
diff --git a/frontend/farm_designer/saved_gardens/saved_gardens.tsx b/frontend/farm_designer/saved_gardens/saved_gardens.tsx
index 2e0ff5571..ef4c9fde6 100644
--- a/frontend/farm_designer/saved_gardens/saved_gardens.tsx
+++ b/frontend/farm_designer/saved_gardens/saved_gardens.tsx
@@ -62,15 +62,6 @@ export class RawSavedGardens
}
}
-/** Link to SavedGardens panel for garden map legend. */
-export const SavedGardensLink = () =>
- ;
-
/** Check if a SavedGarden is currently open (URL approach). */
export const savedGardenOpen = (pathArray: string[]) =>
pathArray[3] === "gardens" && parseInt(pathArray[4]) > 0
diff --git a/frontend/tos_update/__tests__/component_test.tsx b/frontend/tos_update/__tests__/component_test.tsx
index 4d77e7df7..f35a57f85 100644
--- a/frontend/tos_update/__tests__/component_test.tsx
+++ b/frontend/tos_update/__tests__/component_test.tsx
@@ -16,9 +16,9 @@ import { API } from "../../api/index";
import { Session } from "../../session";
import { error } from "../../toast/toast";
import { formEvent, inputEvent } from "../../__test_support__/fake_html_events";
+import { TermsCheckbox } from "../../front_page/terms_checkbox";
describe("", () => {
- const instance = () => shallow().instance();
it("renders correctly when envs are set", () => {
const oldTos = globalConfig.TOS_URL;
const oldPriv = globalConfig.PRIV_URL;
@@ -31,7 +31,7 @@ describe("", () => {
});
it("has a setter", () => {
- const tosUpdate = instance();
+ const tosUpdate = shallow().instance();
tosUpdate.setState = jest.fn();
tosUpdate.set("email")(inputEvent("foo@bar.com"));
expect(tosUpdate.setState).toHaveBeenCalledWith({ email: "foo@bar.com" });
@@ -47,7 +47,7 @@ describe("", () => {
it("submits a form", async () => {
location.assign = jest.fn();
- const i = instance();
+ const i = shallow().instance();
i.setState(fake);
await i.submit(fakeFormEvent);
expect(fakeFormEvent.preventDefault).toHaveBeenCalled();
@@ -59,7 +59,7 @@ describe("", () => {
it("errors while submitting", async () => {
mockPostResponse = Promise.reject({ response: { data: ["error"] } });
- const i = instance();
+ const i = shallow().instance();
i.setState(fake);
await i.submit(fakeFormEvent);
expect(fakeFormEvent.preventDefault).toHaveBeenCalled();
@@ -75,4 +75,31 @@ describe("", () => {
["https://farm.bot/privacy/", "https://farm.bot/tos/"]
.map(string => expect(el.html()).toContain(string));
});
+
+ it("accepts terms", () => {
+ const wrapper = mount();
+ const tosForm = shallow(wrapper.instance().tosForm());
+ expect(wrapper.state().agree_to_terms).toBeFalsy();
+ tosForm.find(TermsCheckbox).simulate("change", {
+ currentTarget: { checked: true }
+ });
+ expect(wrapper.state().agree_to_terms).toBeTruthy();
+ });
+
+ it("errors on click", () => {
+ const wrapper = mount();
+ expect(wrapper.state().agree_to_terms).toBeFalsy();
+ const tosForm = shallow(wrapper.instance().tosForm());
+ tosForm.find("button").simulate("click");
+ expect(error).toHaveBeenCalledWith("Please agree to the terms.");
+ });
+
+ it("doesn't error on click", () => {
+ const wrapper = mount();
+ wrapper.setState({ agree_to_terms: true });
+ expect(wrapper.state().agree_to_terms).toBeTruthy();
+ const tosForm = shallow(wrapper.instance().tosForm());
+ tosForm.find("button").simulate("click");
+ expect(error).not.toHaveBeenCalled();
+ });
});