Skip to content

Commit

Permalink
Merge pull request #10 from dev-madhurendra/FE_Testing-Check
Browse files Browse the repository at this point in the history
💚 Fixing CI CD for testing
  • Loading branch information
dev-madhurendra authored Dec 22, 2023
2 parents d7d6de1 + 5348866 commit 5e6c080
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions frontend/src/components/atoms/Button/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,29 @@ describe('MuiButton Tests', () => {
render(<MuiButton children="Resume" />);
const buttonElement = screen.getByText("Resume");
expect(buttonElement).toBeInTheDocument();
});
})
});

it("calls onclick function when clicked" , () => {
const onClickMock = jest.fn();
render(<MuiButton children="Resume" onClick={onClickMock} />);
const buttonElement = screen.getByText("Resume");
buttonElement.click();
expect(onClickMock).toHaveBeenCalledTimes(1);
})

it("disables the button when disabled prop is true", () => {
render(<MuiButton disabled={true} children="Disabled" />);
const buttonElement = screen.getByText("Disabled");
expect(buttonElement).toBeDisabled();
});

it("applies custom styles to the button", () => {
const customStyle = {
color: "green",
backgroundColor: "black",
}
render(<MuiButton children="Custom Styled" style={customStyle} />);
const buttonElement = screen.getByText("Custom Styled");
expect(buttonElement).toHaveStyle(customStyle);
});
})

0 comments on commit 5e6c080

Please sign in to comment.