From 534886653a4758eda94aaafd972db2620d8273c2 Mon Sep 17 00:00:00 2001 From: madhuredra Date: Fri, 22 Dec 2023 11:55:13 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20Fixing=20CI=20CD=20for=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/atoms/Button/index.test.tsx | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/atoms/Button/index.test.tsx b/frontend/src/components/atoms/Button/index.test.tsx index 70c00416..eb279fa9 100644 --- a/frontend/src/components/atoms/Button/index.test.tsx +++ b/frontend/src/components/atoms/Button/index.test.tsx @@ -8,5 +8,29 @@ describe('MuiButton Tests', () => { render(); const buttonElement = screen.getByText("Resume"); expect(buttonElement).toBeInTheDocument(); - }); -}) \ No newline at end of file + }); + + it("calls onclick function when clicked" , () => { + const onClickMock = jest.fn(); + render(); + const buttonElement = screen.getByText("Resume"); + buttonElement.click(); + expect(onClickMock).toHaveBeenCalledTimes(1); + }) + + it("disables the button when disabled prop is true", () => { + render(); + const buttonElement = screen.getByText("Disabled"); + expect(buttonElement).toBeDisabled(); + }); + + it("applies custom styles to the button", () => { + const customStyle = { + color: "green", + backgroundColor: "black", + } + render(); + const buttonElement = screen.getByText("Custom Styled"); + expect(buttonElement).toHaveStyle(customStyle); + }); +}) \ No newline at end of file