Skip to content

Commit

Permalink
Pol Gubau; MW-Correcting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PolGubau committed Aug 18, 2023
1 parent d05dc73 commit 450b60c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/components/Buttons/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,3 @@ const Button: React.FC<Props> = ({
};
export default Button;

// ${size === "large" ? "px-4 py-3 text-lg" : ""}
// ${size === "normal" ? "px-4 py-2 text-base" : ""}
// ${size === "small" ? "px-3 py-1.5 text-sm rounded-lg" : ""}
18 changes: 18 additions & 0 deletions src/components/Buttons/Button/Test/Button.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,22 @@ describe("Button Component", () => {
const button = screen.getByText(Texts.TEXT);
expect(button).toHaveClass("bg-transparent text-primary");
});

// Centered

test("If centered prop is true, should have justify-center text-center classes", () => {
render(<Button centered>{Texts.TEXT}</Button>);
const button = screen.getByText(Texts.TEXT);
expect(button).toHaveClass("justify-center text-center");
});

test("if onlyIcon prop is true, then there is not children", () => {
render(
<Button onlyIcon icon="search">
Children
</Button>
);
const button = screen.getByRole("button");
expect(button).not.toHaveTextContent("Children");
});
});
6 changes: 6 additions & 0 deletions src/utils/storageFunctions/storageFunctions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ describe("Storage Functions", () => {
localStorageMock.clear();
});

it("the 3 functions should be defined", () => {
expect(getLocalStorage).toBeDefined();
expect(setToLocalStorage).toBeDefined();
expect(removeFromLocalStorage).toBeDefined();
});

it("should get a value from localStorage", () => {
const key = "testKey";
const initialValue = "defaultValue";
Expand Down

0 comments on commit 450b60c

Please sign in to comment.