Files
inkling/tests/unit/Sidebar.test.tsx
th-kim0823 7b3450d0d5 feat(ui): Sidebar + NotebookList + NotebookCreateModal stub
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 10:47:07 +09:00

36 lines
1.2 KiB
TypeScript

// @vitest-environment jsdom
import { describe, it, expect, beforeEach, vi } from 'vitest';
import '@testing-library/jest-dom/vitest';
import { render, screen, cleanup } from '@testing-library/react';
vi.mock('../../src/renderer/inbox/api.js', () => ({
inboxApi: {} as never,
notebookApi: {} as never
}));
import { Sidebar } from '../../src/renderer/inbox/components/Sidebar';
import { useInbox } from '../../src/renderer/inbox/store';
describe('Sidebar', () => {
beforeEach(() => {
cleanup();
useInbox.setState({ sidebarVisible: false, sidebarWidth: 240, notebooks: [], selectedNotebookId: null } as never);
});
it('sidebarVisible=false 면 렌더링 안 함', () => {
const { container } = render(<Sidebar />);
expect(container.firstChild).toBeNull();
});
it('sidebarVisible=true 면 NotebookList 렌더링', () => {
useInbox.setState({
sidebarVisible: true,
sidebarWidth: 240,
notebooks: [{ id: 'nb-1', name: '기본', color: null, createdAt: 't', updatedAt: 't', noteCount: 0 }],
selectedNotebookId: 'nb-1'
} as never);
render(<Sidebar />);
expect(screen.getByText('기본')).toBeInTheDocument();
});
});