Responsive app shell, routes and navigation (#38)
CI / ci (push) Successful in 1m30s

Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
Co-committed-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #38.
This commit is contained in:
2026-10-03 18:40:34 -04:00
committed by approver_agent
parent a453a84231
commit 998658b42c
17 changed files with 727 additions and 19 deletions
+44 -10
View File
@@ -1,15 +1,49 @@
import { render, screen } from '@testing-library/react'
import { MemoryRouter } from 'react-router'
import { describe, expect, it } from 'vitest'
import App from './App.tsx'
import { afterEach, describe, expect, it } from 'vitest'
import { mockViewport } from './test/matchMedia.ts'
import App, { routes } from './App.tsx'
describe('App', () => {
it('renders the MealQuest shell', () => {
render(
<MemoryRouter>
<App />
</MemoryRouter>,
)
expect(screen.getByRole('heading', { name: 'MealQuest' })).toBeInTheDocument()
afterEach(() => {
Reflect.deleteProperty(window, 'matchMedia')
})
function renderAt(path: string) {
render(
<MemoryRouter initialEntries={[path]}>
<App />
</MemoryRouter>,
)
}
describe('App routes', () => {
it('registers every handoff route plus the extra settings pages', () => {
expect(routes.map((route) => route.path)).toEqual([
'/',
'/onboarding',
'/plan',
'/plan/shopping',
'/plan/shopping/archive',
'/discover',
'/quick',
'/cook-from-pantry',
'/dinner/:id',
'/settings',
'/settings/notifications',
'/settings/ai',
'/settings/household',
'/settings/regulars',
'/settings/calendar',
])
})
it.each(routes.map(({ path, title }) => [path.replace(':id', 'abc123'), title]))(
'%s renders its placeholder page inside the shell',
(path, title) => {
mockViewport(390)
renderAt(path)
expect(screen.getByRole('main')).toContainElement(screen.getByRole('heading', { level: 1, name: title }))
expect(screen.getByRole('navigation', { name: 'Primary' })).toBeInTheDocument()
},
)
})