From 5e41ed2cb3e76f06c821500581328b7b8d3475f6 Mon Sep 17 00:00:00 2001 From: Annie Lee <71157062+leeyun-amzn@users.noreply.github.com> Date: Wed, 17 Nov 2021 11:01:16 -0800 Subject: [PATCH] Add refresh button to rollup page (#132) Signed-off-by: Annie Lee --- .../containers/Rollups/Rollups.test.tsx | 10 ++++++++++ .../Rollups/containers/Rollups/Rollups.tsx | 5 +++++ .../__snapshots__/Rollups.test.tsx.snap | 20 +++++++++++++++++++ .../containers/Transforms/Transforms.test.tsx | 10 ++++++++++ 4 files changed, 45 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/Rollups/containers/Rollups/Rollups.tsx b/public/pages/Rollups/containers/Rollups/Rollups.tsx index 7a1746fdf..15212fd86 100644 --- a/public/pages/Rollups/containers/Rollups/Rollups.tsx +++ b/public/pages/Rollups/containers/Rollups/Rollups.tsx @@ -392,6 +392,11 @@ export default class Rollups extends Component { + + + Refresh + + Disable diff --git a/public/pages/Rollups/containers/Rollups/__snapshots__/Rollups.test.tsx.snap b/public/pages/Rollups/containers/Rollups/__snapshots__/Rollups.test.tsx.snap index 382d48585..760cf3103 100644 --- a/public/pages/Rollups/containers/Rollups/__snapshots__/Rollups.test.tsx.snap +++ b/public/pages/Rollups/containers/Rollups/__snapshots__/Rollups.test.tsx.snap @@ -27,6 +27,26 @@ exports[` spec renders the component 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); + }); });