7e8f4859cd
- Add ADR-036 unified OCR architecture (typhoon-ocr via Ollama) - Extend AI execution profiles for OCR sandbox configuration - Add comprehensive frontend test coverage (components, hooks, services) - Add backend test coverage for document-numbering services - Update OCR sidecar with typhoon-ocr integration - Add AI policy service and execution profile management - Update AGENTS.md and architecture documentation
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
// File: frontend/components/layout/__tests__/dashboard-shell.test.tsx
|
|
// Change Log:
|
|
// - 2026-06-13: Initial creation - test coverage for DashboardShell component
|
|
|
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
import { render, screen } from '@testing-library/react';
|
|
import { act } from '@testing-library/react';
|
|
import { DashboardShell } from '../dashboard-shell';
|
|
import { useUIStore } from '@/lib/stores/ui-store';
|
|
|
|
describe('DashboardShell', () => {
|
|
beforeEach(() => {
|
|
act(() => {
|
|
useUIStore.setState({ isSidebarOpen: true });
|
|
});
|
|
});
|
|
|
|
it('ควรเรนเดอร์ children ได้ถูกต้อง', () => {
|
|
render(
|
|
<DashboardShell>
|
|
<div>Test Content</div>
|
|
</DashboardShell>,
|
|
);
|
|
expect(screen.getByText('Test Content')).toBeInTheDocument();
|
|
});
|
|
|
|
it('ควรมี class md:ml-[240px] เมื่อ isSidebarOpen เป็น true', () => {
|
|
act(() => {
|
|
useUIStore.setState({ isSidebarOpen: true });
|
|
});
|
|
const { container } = render(
|
|
<DashboardShell>
|
|
<div>Content</div>
|
|
</DashboardShell>,
|
|
);
|
|
const wrapper = container.firstChild as HTMLElement;
|
|
expect(wrapper.className).toContain('md:ml-[240px]');
|
|
});
|
|
|
|
it('ควรมี class md:ml-[70px] เมื่อ isSidebarOpen เป็น false', () => {
|
|
act(() => {
|
|
useUIStore.setState({ isSidebarOpen: false });
|
|
});
|
|
const { container } = render(
|
|
<DashboardShell>
|
|
<div>Content</div>
|
|
</DashboardShell>,
|
|
);
|
|
const wrapper = container.firstChild as HTMLElement;
|
|
expect(wrapper.className).toContain('md:ml-[70px]');
|
|
});
|
|
});
|