Skip to content

Commit 9add5d6

Browse files
authored
test(page): add disabled copy link button tests (JhaSourav07#759)
2 parents d138b96 + 8c15a84 commit 9add5d6

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

app/page.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,24 @@ describe('LandingPage', () => {
166166
});
167167
});
168168

169+
it('disables Copy Link button when username is empty', () => {
170+
render(<LandingPage />);
171+
172+
const copyButton = screen.getByText('Copy Link').closest('button');
173+
174+
expect(copyButton?.disabled).toBe(true);
175+
});
176+
177+
it('does not copy link when username is empty', () => {
178+
render(<LandingPage />);
179+
180+
const copyButton = screen.getByText('Copy Link').closest('button');
181+
182+
fireEvent.click(copyButton!);
183+
184+
expect(navigator.clipboard.writeText).not.toHaveBeenCalled();
185+
});
186+
169187
it('renders the FeatureCards', () => {
170188
render(<LandingPage />);
171189
expect(screen.getByText('Real-time Sync')).toBeDefined();

0 commit comments

Comments
 (0)