First set o' unmount() calls.

pull/1007/head
Rick Carlino 2018-10-12 13:14:49 -05:00
parent 7dd988b310
commit 156cd9525c
7 changed files with 17 additions and 3 deletions

View File

@ -51,7 +51,7 @@ services:
- ./docker_volumes/rabbit:/farmbot
webpack: # ====================
<<: *base_config
image: node:8.12.0-alpine
image: node:8.12.0
working_dir: /farmbot
command: ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js
volumes:

View File

@ -64,6 +64,7 @@ describe("<App />: Loading", () => {
it("MUST_LOADs not loaded", () => {
const wrapper = mount(<App {...fakeProps()} />);
expect(wrapper.text()).toContain("Loading...");
wrapper.unmount();
});
it("MUST_LOADs partially loaded", () => {
@ -71,6 +72,7 @@ describe("<App />: Loading", () => {
p.loaded = ["Sequence"];
const wrapper = mount(<App {...p} />);
expect(wrapper.text()).toContain("Loading...");
wrapper.unmount();
});
it("MUST_LOADs loaded", () => {
@ -78,6 +80,7 @@ describe("<App />: Loading", () => {
p.loaded = ["Sequence", "Regimen", "FarmEvent", "Point"];
const wrapper = mount(<App {...p} />);
expect(wrapper.text()).not.toContain("Loading...");
wrapper.unmount();
});
});
@ -86,10 +89,12 @@ describe("<App />: NavBar", () => {
const wrapper = mount(<App {...fakeProps()} />);
expect(wrapper.text())
.toContain("Farm DesignerControlsDeviceSequencesRegimensToolsFarmware");
wrapper.unmount();
});
it("displays ticker", () => {
const wrapper = mount(<App {...fakeProps()} />);
expect(wrapper.text()).toContain("No logs yet.");
wrapper.unmount();
});
});

View File

@ -29,6 +29,8 @@ describe("<ControlsPopup />", () => {
p.axisInversion.x = true;
const wrapper = mount(<ControlsPopup {...p} />);
afterAll(wrapper.unmount);
it("Has a false initial state", () => {
expect(wrapper.state("isOpen")).toBeFalsy();
});

View File

@ -31,5 +31,7 @@ describe("<CrashPage/>", () => {
jest.resetAllMocks();
el.find("a").first().simulate("click");
expect(Session.clear).toHaveBeenCalled();
el.unmount();
});
});

View File

@ -38,5 +38,6 @@ describe("<Link/>", () => {
function Child(_: unknown) { return <p>Hey!</p>; }
const el = shallow(<Link to="/wherever"><Child /></Link>);
expect(el.html()).toContain("Hey!");
el.unmount();
});
});

View File

@ -9,6 +9,7 @@ describe("<LoadingPlant/>", () => {
expect(wrapper.find(".loading-plant-text").props().y).toEqual(150);
expect(wrapper.text()).toContain("Loading");
expect(wrapper.find(".animate").length).toEqual(0);
wrapper.unmount();
});
it("renders loading animation", () => {
@ -21,5 +22,6 @@ describe("<LoadingPlant/>", () => {
expect(wrapper.find(".loading-plant-text").props().y).toEqual(435);
expect(wrapper.text()).toContain("Loading");
expect(wrapper.find(".animate").length).toEqual(1);
wrapper.unmount();
});
});

View File

@ -30,14 +30,16 @@ describe("<RootComponent />", () => {
it("clears session when not authorized", () => {
mockAuth = undefined;
mockPathname = "/app/account";
shallow(<RootComponent store={store} />);
const wrapper = shallow(<RootComponent store={store} />);
expect(Session.clear).toHaveBeenCalled();
wrapper.unmount();
});
it("authorized", () => {
mockAuth = auth;
mockPathname = "/app/account";
shallow(<RootComponent store={store} />);
const wrapper = shallow(<RootComponent store={store} />);
expect(Session.clear).not.toHaveBeenCalled();
wrapper.unmount();
});
});