Skip to content

Commit

Permalink
Add test to copy button
Browse files Browse the repository at this point in the history
  • Loading branch information
OKendigelyan committed Aug 21, 2024
1 parent 16b0ab6 commit 6f4ccbe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apps/web/src/components/CopyButton/CopyButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,19 @@ describe("<CopyButton />", () => {

expect(navigator.clipboard.writeText).toHaveBeenCalledWith("hello");
});

it("disables copy logic when isCopyDisabled is true", async () => {
const user = userEvent.setup();
jest.spyOn(navigator.clipboard, "writeText");

render(
<CopyButton isCopyDisabled value="hello">
Copy
</CopyButton>
);

await act(() => user.click(screen.getByTestId("copy-button")));

expect(navigator.clipboard.writeText).not.toHaveBeenCalled();
});
});

1 comment on commit 6f4ccbe

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title Lines Statements Branches Functions
apps/desktop Coverage: 84%
84.01% (1818/2164) 79.17% (859/1085) 78.68% (454/577)
apps/web Coverage: 84%
84.01% (1818/2164) 79.17% (859/1085) 78.68% (454/577)
packages/components Coverage: 96%
96.89% (125/129) 98.07% (51/52) 84.21% (32/38)
packages/core Coverage: 81%
82.46% (174/211) 70.75% (75/106) 81.13% (43/53)
packages/crypto Coverage: 100%
100% (28/28) 100% (3/3) 100% (5/5)
packages/data-polling Coverage: 98%
96.55% (140/145) 95.45% (21/22) 92.85% (39/42)
packages/multisig Coverage: 98%
98.4% (123/125) 89.47% (17/19) 100% (33/33)
packages/social-auth Coverage: 100%
100% (22/22) 100% (11/11) 100% (4/4)
packages/state Coverage: 84%
84.17% (766/910) 80.4% (160/199) 79.33% (288/363)
packages/tezos Coverage: 86%
85.1% (80/94) 92.85% (13/14) 82.14% (23/28)
packages/tzkt Coverage: 86%
84.05% (58/69) 81.25% (13/16) 76.92% (30/39)

Please sign in to comment.