mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 06:11:45 +00:00
test: expand frontend test suite to 82% coverage
Adds ~45 new and updated test files covering Admin, Collab, Dashboard, Map, Memories, PDF, Photos, Planner, Settings, Vacay, Weather components, pages, stores, and a WebSocket integration test.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { render, screen } from '../../../tests/helpers/render';
|
||||
import { render, screen, fireEvent } from '../../../tests/helpers/render';
|
||||
import { resetAllStores } from '../../../tests/helpers/store';
|
||||
import AboutTab from './AboutTab';
|
||||
|
||||
@@ -82,4 +82,70 @@ describe('AboutTab', () => {
|
||||
expect(screen.getByText('v1.0.0')).toBeInTheDocument();
|
||||
expect(screen.queryByText('v2.9.10')).toBeNull();
|
||||
});
|
||||
|
||||
it('FE-COMP-ABOUT-012: Ko-fi link hover changes border and box-shadow styles', () => {
|
||||
render(<AboutTab appVersion="1.0.0" />);
|
||||
const link = screen.getByText('Ko-fi').closest('a') as HTMLAnchorElement;
|
||||
fireEvent.mouseEnter(link);
|
||||
expect(link.style.borderColor).toBe('rgb(255, 94, 91)');
|
||||
expect(link.style.boxShadow).not.toBe('');
|
||||
fireEvent.mouseLeave(link);
|
||||
expect(link.style.borderColor).toBe('var(--border-primary)');
|
||||
expect(link.style.boxShadow).toBe('none');
|
||||
});
|
||||
|
||||
it('FE-COMP-ABOUT-013: Buy Me a Coffee link hover changes border and box-shadow styles', () => {
|
||||
render(<AboutTab appVersion="1.0.0" />);
|
||||
const link = screen.getByText('Buy Me a Coffee').closest('a') as HTMLAnchorElement;
|
||||
fireEvent.mouseEnter(link);
|
||||
expect(link.style.borderColor).toBe('rgb(255, 221, 0)');
|
||||
expect(link.style.boxShadow).not.toBe('');
|
||||
fireEvent.mouseLeave(link);
|
||||
expect(link.style.borderColor).toBe('var(--border-primary)');
|
||||
expect(link.style.boxShadow).toBe('none');
|
||||
});
|
||||
|
||||
it('FE-COMP-ABOUT-014: Discord link hover changes border and box-shadow styles', () => {
|
||||
render(<AboutTab appVersion="1.0.0" />);
|
||||
const link = screen.getByText('Discord').closest('a') as HTMLAnchorElement;
|
||||
fireEvent.mouseEnter(link);
|
||||
expect(link.style.borderColor).toBe('rgb(88, 101, 242)');
|
||||
expect(link.style.boxShadow).not.toBe('');
|
||||
fireEvent.mouseLeave(link);
|
||||
expect(link.style.borderColor).toBe('var(--border-primary)');
|
||||
expect(link.style.boxShadow).toBe('none');
|
||||
});
|
||||
|
||||
it('FE-COMP-ABOUT-015: Bug report link hover changes border and box-shadow styles', () => {
|
||||
render(<AboutTab appVersion="1.0.0" />);
|
||||
const link = document.querySelector('a[href*="issues/new"]') as HTMLAnchorElement;
|
||||
fireEvent.mouseEnter(link);
|
||||
expect(link.style.borderColor).toBe('rgb(239, 68, 68)');
|
||||
expect(link.style.boxShadow).not.toBe('');
|
||||
fireEvent.mouseLeave(link);
|
||||
expect(link.style.borderColor).toBe('var(--border-primary)');
|
||||
expect(link.style.boxShadow).toBe('none');
|
||||
});
|
||||
|
||||
it('FE-COMP-ABOUT-016: Feature request link hover changes border and box-shadow styles', () => {
|
||||
render(<AboutTab appVersion="1.0.0" />);
|
||||
const link = document.querySelector('a[href*="discussions/new"]') as HTMLAnchorElement;
|
||||
fireEvent.mouseEnter(link);
|
||||
expect(link.style.borderColor).toBe('rgb(245, 158, 11)');
|
||||
expect(link.style.boxShadow).not.toBe('');
|
||||
fireEvent.mouseLeave(link);
|
||||
expect(link.style.borderColor).toBe('var(--border-primary)');
|
||||
expect(link.style.boxShadow).toBe('none');
|
||||
});
|
||||
|
||||
it('FE-COMP-ABOUT-017: Wiki link hover changes border and box-shadow styles', () => {
|
||||
render(<AboutTab appVersion="1.0.0" />);
|
||||
const link = document.querySelector('a[href*="wiki"]') as HTMLAnchorElement;
|
||||
fireEvent.mouseEnter(link);
|
||||
expect(link.style.borderColor).toBe('rgb(99, 102, 241)');
|
||||
expect(link.style.boxShadow).not.toBe('');
|
||||
fireEvent.mouseLeave(link);
|
||||
expect(link.style.borderColor).toBe('var(--border-primary)');
|
||||
expect(link.style.boxShadow).toBe('none');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user