diff --git a/apps/web/src/routes/hq.test.tsx b/apps/web/src/routes/hq.test.tsx
deleted file mode 100644
index 818fc63..0000000
--- a/apps/web/src/routes/hq.test.tsx
+++ /dev/null
@@ -1,156 +0,0 @@
-// @vitest-environment happy-dom
-import '@testing-library/jest-dom/vitest'
-import { render, screen, fireEvent } from '@testing-library/react'
-import { vi, describe, it, expect, beforeEach } from 'vitest'
-
-const mockUseQuery = vi.hoisted(() => vi.fn())
-vi.mock('@/lib/trpc', () => ({
- trpc: {
- getHeadquartersDashboard: { useQuery: mockUseQuery },
- },
-}))
-
-vi.mock('@/hooks', () => ({
- useLiveUpdates: vi.fn(),
- LiveUpdateRule: undefined,
-}))
-
-vi.mock('@/components/hq/HQWaitingForInputSection', () => ({
- HQWaitingForInputSection: ({ items }: any) =>
{items.length}
,
-}))
-
-vi.mock('@/components/hq/HQNeedsReviewSection', () => ({
- HQNeedsReviewSection: ({ initiatives, phases }: any) => (
- {initiatives.length},{phases.length}
- ),
-}))
-
-vi.mock('@/components/hq/HQNeedsApprovalSection', () => ({
- HQNeedsApprovalSection: ({ items }: any) => {items.length}
,
-}))
-
-vi.mock('@/components/hq/HQBlockedSection', () => ({
- HQBlockedSection: ({ items }: any) => {items.length}
,
-}))
-
-vi.mock('@/components/hq/HQEmptyState', () => ({
- HQEmptyState: () => All clear
,
-}))
-
-// Import after mocks are set up
-import { HeadquartersPage } from './hq'
-
-const emptyData = {
- waitingForInput: [],
- pendingReviewInitiatives: [],
- pendingReviewPhases: [],
- planningInitiatives: [],
- blockedPhases: [],
-}
-
-describe('HeadquartersPage', () => {
- beforeEach(() => {
- vi.clearAllMocks()
- })
-
- it('renders skeleton loading state', () => {
- mockUseQuery.mockReturnValue({ isLoading: true, isError: false, data: undefined })
- render()
-
- // Should show heading
- expect(screen.getByText('Headquarters')).toBeInTheDocument()
- // Should show skeleton elements (there are 3)
- const skeletons = document.querySelectorAll('[class*="skeleton"], [class*="h-16"]')
- expect(skeletons.length).toBeGreaterThan(0)
- // No section components
- expect(screen.queryByTestId('waiting')).not.toBeInTheDocument()
- expect(screen.queryByTestId('needs-review')).not.toBeInTheDocument()
- expect(screen.queryByTestId('needs-approval')).not.toBeInTheDocument()
- expect(screen.queryByTestId('blocked')).not.toBeInTheDocument()
- expect(screen.queryByTestId('empty-state')).not.toBeInTheDocument()
- })
-
- it('renders error state with retry button', () => {
- const mockRefetch = vi.fn()
- mockUseQuery.mockReturnValue({ isLoading: false, isError: true, data: undefined, refetch: mockRefetch })
- render()
-
- expect(screen.getByText('Failed to load headquarters data.')).toBeInTheDocument()
- const retryButton = screen.getByRole('button', { name: /retry/i })
- expect(retryButton).toBeInTheDocument()
-
- fireEvent.click(retryButton)
- expect(mockRefetch).toHaveBeenCalledOnce()
- })
-
- it('renders empty state when all arrays are empty', () => {
- mockUseQuery.mockReturnValue({ isLoading: false, isError: false, data: emptyData })
- render()
-
- expect(screen.getByTestId('empty-state')).toBeInTheDocument()
- expect(screen.queryByTestId('waiting')).not.toBeInTheDocument()
- expect(screen.queryByTestId('needs-review')).not.toBeInTheDocument()
- expect(screen.queryByTestId('needs-approval')).not.toBeInTheDocument()
- expect(screen.queryByTestId('blocked')).not.toBeInTheDocument()
- })
-
- it('renders WaitingForInput section when items exist', () => {
- mockUseQuery.mockReturnValue({
- isLoading: false,
- isError: false,
- data: { ...emptyData, waitingForInput: [{ id: '1' }] },
- })
- render()
-
- expect(screen.getByTestId('waiting')).toBeInTheDocument()
- expect(screen.queryByTestId('needs-review')).not.toBeInTheDocument()
- expect(screen.queryByTestId('needs-approval')).not.toBeInTheDocument()
- expect(screen.queryByTestId('blocked')).not.toBeInTheDocument()
- expect(screen.queryByTestId('empty-state')).not.toBeInTheDocument()
- })
-
- it('renders all four sections when all arrays have items', () => {
- mockUseQuery.mockReturnValue({
- isLoading: false,
- isError: false,
- data: {
- waitingForInput: [{ id: '1' }],
- pendingReviewInitiatives: [{ id: '2' }],
- pendingReviewPhases: [{ id: '3' }],
- planningInitiatives: [{ id: '4' }],
- blockedPhases: [{ id: '5' }],
- },
- })
- render()
-
- expect(screen.getByTestId('waiting')).toBeInTheDocument()
- expect(screen.getByTestId('needs-review')).toBeInTheDocument()
- expect(screen.getByTestId('needs-approval')).toBeInTheDocument()
- expect(screen.getByTestId('blocked')).toBeInTheDocument()
- expect(screen.queryByTestId('empty-state')).not.toBeInTheDocument()
- })
-
- it('renders NeedsReview section when only pendingReviewInitiatives has items', () => {
- mockUseQuery.mockReturnValue({
- isLoading: false,
- isError: false,
- data: { ...emptyData, pendingReviewInitiatives: [{ id: '1' }] },
- })
- render()
-
- expect(screen.getByTestId('needs-review')).toBeInTheDocument()
- expect(screen.queryByTestId('empty-state')).not.toBeInTheDocument()
- })
-
- it('renders NeedsReview section when only pendingReviewPhases has items', () => {
- mockUseQuery.mockReturnValue({
- isLoading: false,
- isError: false,
- data: { ...emptyData, pendingReviewPhases: [{ id: '1' }] },
- })
- render()
-
- expect(screen.getByTestId('needs-review')).toBeInTheDocument()
- expect(screen.queryByTestId('empty-state')).not.toBeInTheDocument()
- })
-})