Skip to content

Commit df8a789

Browse files
test: add Footer component tests
1 parent 6c969f6 commit df8a789

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

app/components/Footer.test.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { render, screen } from '@testing-library/react';
3+
import { Footer } from './Footer';
4+
5+
describe('Footer Component', () => {
6+
it('renders community text', () => {
7+
render(<Footer />);
8+
9+
const text = screen.getByText(/Designed for the elite builder community/i);
10+
11+
expect(text).toBeTruthy();
12+
});
13+
14+
it('renders Documentation link', () => {
15+
render(<Footer />);
16+
17+
const docLink = screen.getByText(/Documentation/i);
18+
19+
expect(docLink).toBeTruthy();
20+
21+
expect(docLink.closest('a')?.getAttribute('href')).toBe(
22+
'https://github.com/JhaSourav07/commitpulse/blob/main/README.md'
23+
);
24+
});
25+
26+
it('opens documentation in new tab', () => {
27+
render(<Footer />);
28+
29+
const docLink = screen.getByText(/Documentation/i);
30+
31+
expect(docLink.closest('a')?.getAttribute('target')).toBe('_blank');
32+
});
33+
34+
it('renders Contributors link', () => {
35+
render(<Footer />);
36+
37+
const contributorsLink = screen.getByText(/Contributors/i);
38+
39+
expect(contributorsLink).toBeTruthy();
40+
});
41+
});

0 commit comments

Comments
 (0)