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", + }); + }); }); });