From 156cd9525caafaa5db0fd9695770dfc0260ca2d2 Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Fri, 12 Oct 2018 13:14:49 -0500 Subject: [PATCH] First set o' unmount() calls. --- docker-compose.yml | 2 +- webpack/__tests__/app_test.tsx | 5 +++++ webpack/__tests__/controls_popup_test.tsx | 2 ++ webpack/__tests__/crash_page_test.tsx | 2 ++ webpack/__tests__/link_test.tsx | 1 + webpack/__tests__/loading_plant_test.tsx | 2 ++ webpack/__tests__/routes_test.tsx | 6 ++++-- 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5f372998a..39b5e7c99 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/webpack/__tests__/app_test.tsx b/webpack/__tests__/app_test.tsx index f7cbb0e22..d5327ec8f 100644 --- a/webpack/__tests__/app_test.tsx +++ b/webpack/__tests__/app_test.tsx @@ -64,6 +64,7 @@ describe(": Loading", () => { it("MUST_LOADs not loaded", () => { const wrapper = mount(); expect(wrapper.text()).toContain("Loading..."); + wrapper.unmount(); }); it("MUST_LOADs partially loaded", () => { @@ -71,6 +72,7 @@ describe(": Loading", () => { p.loaded = ["Sequence"]; const wrapper = mount(); expect(wrapper.text()).toContain("Loading..."); + wrapper.unmount(); }); it("MUST_LOADs loaded", () => { @@ -78,6 +80,7 @@ describe(": Loading", () => { p.loaded = ["Sequence", "Regimen", "FarmEvent", "Point"]; const wrapper = mount(); expect(wrapper.text()).not.toContain("Loading..."); + wrapper.unmount(); }); }); @@ -86,10 +89,12 @@ describe(": NavBar", () => { const wrapper = mount(); expect(wrapper.text()) .toContain("Farm DesignerControlsDeviceSequencesRegimensToolsFarmware"); + wrapper.unmount(); }); it("displays ticker", () => { const wrapper = mount(); expect(wrapper.text()).toContain("No logs yet."); + wrapper.unmount(); }); }); diff --git a/webpack/__tests__/controls_popup_test.tsx b/webpack/__tests__/controls_popup_test.tsx index 7cfa448bc..20fc16f0b 100644 --- a/webpack/__tests__/controls_popup_test.tsx +++ b/webpack/__tests__/controls_popup_test.tsx @@ -29,6 +29,8 @@ describe("", () => { p.axisInversion.x = true; const wrapper = mount(); + afterAll(wrapper.unmount); + it("Has a false initial state", () => { expect(wrapper.state("isOpen")).toBeFalsy(); }); diff --git a/webpack/__tests__/crash_page_test.tsx b/webpack/__tests__/crash_page_test.tsx index 225f29e9a..0e6164c00 100644 --- a/webpack/__tests__/crash_page_test.tsx +++ b/webpack/__tests__/crash_page_test.tsx @@ -31,5 +31,7 @@ describe("", () => { jest.resetAllMocks(); el.find("a").first().simulate("click"); expect(Session.clear).toHaveBeenCalled(); + el.unmount(); + }); }); diff --git a/webpack/__tests__/link_test.tsx b/webpack/__tests__/link_test.tsx index d68bcd089..8e5e359dc 100644 --- a/webpack/__tests__/link_test.tsx +++ b/webpack/__tests__/link_test.tsx @@ -38,5 +38,6 @@ describe("", () => { function Child(_: unknown) { return

Hey!

; } const el = shallow(); expect(el.html()).toContain("Hey!"); + el.unmount(); }); }); diff --git a/webpack/__tests__/loading_plant_test.tsx b/webpack/__tests__/loading_plant_test.tsx index 81fc219f8..3368f5322 100644 --- a/webpack/__tests__/loading_plant_test.tsx +++ b/webpack/__tests__/loading_plant_test.tsx @@ -9,6 +9,7 @@ describe("", () => { 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("", () => { expect(wrapper.find(".loading-plant-text").props().y).toEqual(435); expect(wrapper.text()).toContain("Loading"); expect(wrapper.find(".animate").length).toEqual(1); + wrapper.unmount(); }); }); diff --git a/webpack/__tests__/routes_test.tsx b/webpack/__tests__/routes_test.tsx index 82c6f78fa..f92a7bef3 100644 --- a/webpack/__tests__/routes_test.tsx +++ b/webpack/__tests__/routes_test.tsx @@ -30,14 +30,16 @@ describe("", () => { it("clears session when not authorized", () => { mockAuth = undefined; mockPathname = "/app/account"; - shallow(); + const wrapper = shallow(); expect(Session.clear).toHaveBeenCalled(); + wrapper.unmount(); }); it("authorized", () => { mockAuth = auth; mockPathname = "/app/account"; - shallow(); + const wrapper = shallow(); expect(Session.clear).not.toHaveBeenCalled(); + wrapper.unmount(); }); });