Full tests coverage

This commit is contained in:
Aerilyn Weber 2026-05-19 14:09:03 +09:00
parent 99134d8556
commit 02d782c3da
157 changed files with 1074 additions and 34670 deletions

View file

@ -1,8 +1,13 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
const themeMock = vi.hoisted(() => ({
theme: 'light',
toggleTheme: vi.fn(),
}));
vi.mock('@/components/ThemeProvider', () => ({
useTheme: () => ({ theme: 'light', toggleTheme: vi.fn() }),
useTheme: () => themeMock,
}));
vi.mock('@/components/layout/PageHeaderContext', () => ({
@ -39,4 +44,10 @@ describe('TopBar', () => {
render(<TopBar />);
expect(screen.getByLabelText('Toggle theme')).toBeInTheDocument();
});
it('renders sun icon when theme is dark', () => {
themeMock.theme = 'dark';
render(<TopBar />);
expect(screen.getByLabelText('Toggle theme')).toBeInTheDocument();
});
});