From 8ad57275a3a68d54a6a22ae104cd8d3252278a20 Mon Sep 17 00:00:00 2001 From: delianides Date: Thu, 5 Jan 2017 13:52:37 -0500 Subject: [PATCH] added tests to account for previous schedule defect --- .../blocks/add-to-cart/Schedule/__tests__/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/imports/blocks/add-to-cart/Schedule/__tests__/index.js b/imports/blocks/add-to-cart/Schedule/__tests__/index.js index b913624f2..9e36fc828 100644 --- a/imports/blocks/add-to-cart/Schedule/__tests__/index.js +++ b/imports/blocks/add-to-cart/Schedule/__tests__/index.js @@ -272,5 +272,16 @@ describe("Class", () => { onDayClick(null, "tuesday", { selected: false }); expect(wrapper.state().start).toEqual("tuesday"); }); + it("calls saveSchedule when a data is selected", () => { + const saveSchedule = jest.fn(); + const wrapper = mount(generateComponent({ saveSchedule })); + wrapper.setState({ start: "custom", frequency: "monthly" }); + const { onDayClick } = wrapper.instance(); + onDayClick(null, "tuesday", { selected: true }); + expect(saveSchedule).toBeCalledWith({ + frequency: "monthly", + start: "tuesday", + }); + }); }); });