Files
cartsnitch-fork-test/src/components/Layout.test.tsx
T
Frontend Frankie 6d576bad40 feat: add core PWA screens (auth, dashboard, purchases, products, alerts, settings)
Build all 8 primary screens for CAR-33 on top of the Phase 1 scaffold:
- Auth: login, register, forgot password with JWT flow and mock fallback
- Dashboard: triggered alerts banner, spending stats, price trend sparklines (Recharts), recent purchases
- Purchase History: store filter chips, paginated list with item previews
- Purchase Detail: receipt view with line items linking to product pages
- Products: search with instant filter, store price comparison badges
- Product Detail: 90-day price history chart (Recharts), store comparison table
- Store Comparison: ranked store cards with savings banner
- Price Alerts: triggered/watching sections, create form, progress bars, delete
- Coupons: expiration warnings, copy-to-clipboard coupon codes
- Account Linking: connect Meijer/Kroger/Target with status indicators
- Settings: profile, connected stores, notification toggles, theme switcher, sign out

Also adds:
- Mock data layer (src/lib/mock-data.ts) for demo/screenshot use
- StoreIcon component with store brand colors
- Code-split Recharts chunk (initial JS: 117KB, Recharts lazy: 498KB)
- All 48px+ touch targets, mobile-first Tailwind layout

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-17 12:24:31 +00:00

52 lines
1.5 KiB
TypeScript

import { render, screen } from '@testing-library/react'
import { MemoryRouter } from 'react-router-dom'
import { describe, it, expect } from 'vitest'
import { BottomNav } from './BottomNav.tsx'
describe('BottomNav', () => {
it('renders all navigation items', () => {
render(
<MemoryRouter>
<BottomNav />
</MemoryRouter>,
)
expect(screen.getByText('Home')).toBeInTheDocument()
expect(screen.getByText('Purchases')).toBeInTheDocument()
expect(screen.getByText('Products')).toBeInTheDocument()
expect(screen.getByText('Coupons')).toBeInTheDocument()
expect(screen.getByText('Settings')).toBeInTheDocument()
})
it('renders navigation links with correct paths', () => {
render(
<MemoryRouter>
<BottomNav />
</MemoryRouter>,
)
const links = screen.getAllByRole('link')
const hrefs = links.map((link) => link.getAttribute('href'))
expect(hrefs).toContain('/')
expect(hrefs).toContain('/purchases')
expect(hrefs).toContain('/products')
expect(hrefs).toContain('/coupons')
expect(hrefs).toContain('/settings')
})
it('has touch-friendly minimum sizes (48px)', () => {
render(
<MemoryRouter>
<BottomNav />
</MemoryRouter>,
)
const links = screen.getAllByRole('link')
links.forEach((link) => {
expect(link.className).toContain('min-h-12')
expect(link.className).toContain('min-w-12')
})
})
})