import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ExportPdfDialog } from '@/components/modals/ExportPdfDialog';
import { useFileStore } from '@/stores/file-store';
import { useEditorStore } from '@/stores/editor-store';
import { useSettingsStore } from '@/stores/settings-store';
vi.mock('@/lib/ipc', () => ({
ipc: {
print: {
show: vi.fn().mockResolvedValue({ ok: true }),
doPrint: vi.fn().mockResolvedValue({ ok: true }),
},
},
}));
import { ipc } from '@/lib/ipc';
describe('ExportPdfDialog', () => {
beforeEach(() => {
localStorage.clear();
vi.clearAllMocks();
useSettingsStore.setState(useSettingsStore.getInitialState());
useFileStore.setState({
activeTabId: '/test.md',
openTabs: [{ id: '/test.md', path: '/test.md', title: 'test.md', dirty: false }],
} as any);
useEditorStore.setState({
buffers: new Map([
['/test.md', { id: '/test.md', path: '/test.md', content: '# hi', dirty: false }],
]),
} as any);
});
it('renders with default PDF options from settings', () => {
render(