import { jsx as _jsx } from "react/jsx-runtime";
// @vitest-environment happy-dom
import { describe, expect, it, vi } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react';
// The Forms nav item expands into a submenu: an "All Entries" child plus one
// child per active form carrying its own unread badge. Mock the sidebar-counts
// fetcher so the children are deterministic.
// Distinct per-form counts so a child badge can't collide with the parent
// total badge (8 + 5 = 13).
const fetchFormsSidebarCounts = vi.fn(async () => [
    { formId: 'f1', name: 'Contact Us', slug: 'contact-us', status: 'active', unread: 8 },
    { formId: 'f2', name: 'Project Inquiry', slug: 'project-inquiry', status: 'active', unread: 5 },
]);
vi.mock('../../lib/forms-service.js', () => ({
    fetchFormsSidebarCounts: () => fetchFormsSidebarCounts(),
}));
const { Sidebar } = await import('../../layout/Sidebar.js');
describe('Sidebar Forms submenu', () => {
    it('renders All Entries plus a child per active form', async () => {
        render(_jsx(Sidebar, { collapsed: false, onToggleCollapse: () => { }, currentPath: "/forms", onNavigate: () => { } }));
        await waitFor(() => expect(screen.getByText('All Entries')).toBeTruthy());
        // Per-form children (the Contact Us label also appears; scope to nav links).
        expect(screen.getByText('Project Inquiry')).toBeTruthy();
        // The form with unread submissions shows its own badge.
        expect(screen.getByLabelText('8 unread')).toBeTruthy();
    });
});
//# sourceMappingURL=sidebar-forms-submenu.render.test.js.map