style(13-03): apply Prettier formatting across repo
Mechanical reformat — no logic changes. 398 files changed, 19125 insertions(+), 16457 deletions(-). Prettier 3.8.4 with .prettierrc (singleQuote:true, semi:true, tabWidth:2, trailingComma:all, printWidth:100). Isolated per D-13-08 for reviewability.
This commit is contained in:
@@ -10,17 +10,17 @@
|
||||
* is visible on both the /calendar and /lists routes.
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import React from 'react';
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
|
||||
// ── Module mocks ────────────────────────────────────────────────────────────
|
||||
|
||||
vi.mock('@schedule-x/react', () => ({
|
||||
useCalendarApp: vi.fn(() => ({})),
|
||||
ScheduleXCalendar: () => <div data-testid="schedule-x-calendar" />,
|
||||
}))
|
||||
}));
|
||||
|
||||
vi.mock('@schedule-x/events-service', () => ({
|
||||
createEventsServicePlugin: vi.fn(() => ({
|
||||
@@ -32,51 +32,51 @@ vi.mock('@schedule-x/events-service', () => ({
|
||||
remove: vi.fn(),
|
||||
update: vi.fn(),
|
||||
})),
|
||||
}))
|
||||
}));
|
||||
|
||||
vi.mock('@schedule-x/event-modal', () => ({
|
||||
createEventModalPlugin: vi.fn(() => ({ name: 'event-modal' })),
|
||||
}))
|
||||
}));
|
||||
|
||||
vi.mock('../api/client.js', () => ({
|
||||
fetchMe: vi.fn(),
|
||||
fetchEvents: vi.fn(),
|
||||
}))
|
||||
}));
|
||||
|
||||
vi.mock('../api/listsClient.js', () => ({
|
||||
fetchLists: vi.fn().mockResolvedValue({ lists: [] }),
|
||||
deleteList: vi.fn(),
|
||||
}))
|
||||
}));
|
||||
|
||||
vi.mock('../lib/hydrateEvents.js', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../lib/hydrateEvents.js')>()
|
||||
return { ...actual, hydrateEvents: vi.fn(actual.hydrateEvents) }
|
||||
})
|
||||
const actual = await importOriginal<typeof import('../lib/hydrateEvents.js')>();
|
||||
return { ...actual, hydrateEvents: vi.fn(actual.hydrateEvents) };
|
||||
});
|
||||
|
||||
// ── Imports (after mocks) ───────────────────────────────────────────────────
|
||||
|
||||
import { fetchMe, fetchEvents } from '../api/client.js'
|
||||
import type { Mock } from 'vitest'
|
||||
import { fetchMe, fetchEvents } from '../api/client.js';
|
||||
import type { Mock } from 'vitest';
|
||||
|
||||
// ── Helpers ─────────────────────────────────────────────────────────────────
|
||||
|
||||
function makeQueryClient() {
|
||||
return new QueryClient({
|
||||
defaultOptions: { queries: { retry: false, staleTime: 0 } },
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// ── Tests ────────────────────────────────────────────────────────────────────
|
||||
|
||||
describe('AppNav persistence across routes (FIX 3)', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
sessionStorage.clear()
|
||||
;(fetchMe as Mock).mockResolvedValue({
|
||||
vi.clearAllMocks();
|
||||
sessionStorage.clear();
|
||||
(fetchMe as Mock).mockResolvedValue({
|
||||
user: { id: 1, displayName: 'Lucas', color: '#4A90D9' },
|
||||
})
|
||||
;(fetchEvents as Mock).mockResolvedValue({ occurrences: [] })
|
||||
})
|
||||
});
|
||||
(fetchEvents as Mock).mockResolvedValue({ occurrences: [] });
|
||||
});
|
||||
|
||||
it('renders AppNav "FamilySync" brand on /lists route (FIX 3: nav persists across routes)', async () => {
|
||||
// This test verifies the fix: AppNav is a persistent app-shell element that
|
||||
@@ -84,9 +84,9 @@ describe('AppNav persistence across routes (FIX 3)', () => {
|
||||
// It renders the app shell layout (AppNav + Routes) with MemoryRouter at /lists
|
||||
// and asserts AppNav's brand text is visible — which would fail if AppNav were
|
||||
// only inside CalendarShell (which unmounts on /lists).
|
||||
const { AppNav } = await import('./AppNav.js')
|
||||
const { Routes, Route, MemoryRouter } = await import('react-router')
|
||||
const client = makeQueryClient()
|
||||
const { AppNav } = await import('./AppNav.js');
|
||||
const { Routes, Route, MemoryRouter } = await import('react-router');
|
||||
const client = makeQueryClient();
|
||||
|
||||
// Simulate the app-shell layout: AppNav is OUTSIDE Routes (persistent), and
|
||||
// Routes renders the /lists page. The 'FamilySync' brand in AppNav must be visible
|
||||
@@ -101,13 +101,13 @@ describe('AppNav persistence across routes (FIX 3)', () => {
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
);
|
||||
|
||||
// FamilySync brand text from AppNav must be present while the /lists route renders
|
||||
const brand = screen.queryAllByText('FamilySync')
|
||||
expect(brand.length).toBeGreaterThan(0)
|
||||
const brand = screen.queryAllByText('FamilySync');
|
||||
expect(brand.length).toBeGreaterThan(0);
|
||||
|
||||
// The Lists page route content also renders
|
||||
expect(screen.getByText('Lists page')).toBeDefined()
|
||||
})
|
||||
})
|
||||
expect(screen.getByText('Lists page')).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user