Skip to content

Commit f9c55d9

Browse files
committed
frontend: add footer tests.
1 parent c911a69 commit f9c55d9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { render, screen } from '@testing-library/preact';
2+
import { describe, it, expect } from 'vitest';
3+
import { Footer } from '../Footer';
4+
import { privacy_notice, terms_of_use, imprint } from 'links';
5+
6+
/**
7+
* Footer component tests
8+
* The i18n mock returns the key itself (with keyPrefix already applied in the component),
9+
* so the visible link texts are the raw keys: privacy_notice, terms_of_use, imprint.
10+
*/
11+
12+
describe('Footer', () => {
13+
it('renders three legal links with correct hrefs', () => {
14+
render(<Footer />);
15+
16+
const privacyLink = screen.getByText('privacy_notice');
17+
const termsLink = screen.getByText('terms_of_use');
18+
const imprintLink = screen.getByText('imprint');
19+
20+
expect(privacyLink).toBeTruthy();
21+
expect(termsLink).toBeTruthy();
22+
expect(imprintLink).toBeTruthy();
23+
24+
expect(privacyLink).toHaveAttribute('href', privacy_notice);
25+
expect(termsLink).toHaveAttribute('href', terms_of_use);
26+
expect(imprintLink).toHaveAttribute('href', imprint);
27+
28+
const allLinks = screen.getAllByRole('link');
29+
// Filter only those inside the footer container if multiple links exist globally
30+
const footerLinks = allLinks.filter(l => ['privacy_notice','terms_of_use','imprint'].includes(l.textContent || ''));
31+
expect(footerLinks).toHaveLength(3);
32+
});
33+
});

0 commit comments

Comments
 (0)