From 516354733b35fd482a99c073f1d82292ce5950b3 Mon Sep 17 00:00:00 2001 From: Annie Lee Date: Tue, 16 Nov 2021 19:17:38 -0800 Subject: [PATCH] Add tests for refresh button --- .../pages/Rollups/containers/Rollups/Rollups.test.tsx | 10 ++++++++++ .../containers/Transforms/Transforms.test.tsx | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/public/pages/Rollups/containers/Rollups/Rollups.test.tsx b/public/pages/Rollups/containers/Rollups/Rollups.test.tsx index fb2ebd4d5..21a9c560d 100644 --- a/public/pages/Rollups/containers/Rollups/Rollups.test.tsx +++ b/public/pages/Rollups/containers/Rollups/Rollups.test.tsx @@ -227,4 +227,14 @@ describe(" spec", () => { expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledTimes(1); expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledWith(`${testRollup._id} is disabled`); }); + + it("calls getRollups when clicking refresh button", async () => { + browserServicesMock.rollupService.getRollups = jest.fn(); + + const { getByTestId } = renderRollupsWithRouter(); + + userEvent.click(getByTestId("refreshButton")); + + expect(browserServicesMock.rollupService.getRollups).toHaveBeenCalledTimes(1); + }); }); diff --git a/public/pages/Transforms/containers/Transforms/Transforms.test.tsx b/public/pages/Transforms/containers/Transforms/Transforms.test.tsx index c3caf053b..041871d36 100644 --- a/public/pages/Transforms/containers/Transforms/Transforms.test.tsx +++ b/public/pages/Transforms/containers/Transforms/Transforms.test.tsx @@ -233,4 +233,14 @@ describe(" spec", () => { expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledTimes(1); expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledWith(`\"${testTransform2._id}\" is disabled`); }); + + it("calls getTransforms when clicking refresh button", async () => { + browserServicesMock.transformService.getTransforms = jest.fn(); + + const { getByTestId } = renderTransformsWithRouter(); + + userEvent.click(getByTestId("refreshButton")); + + expect(browserServicesMock.transformService.getTransforms).toHaveBeenCalledTimes(1); + }); });