feat: wire AdminContent/AdminTestimonials/AdminRules into admin nav and routes

This commit is contained in:
belviskhoremk
2026-08-13 09:35:48 +02:00
parent b72acd8a26
commit af4f0b3a52
3 changed files with 51 additions and 1 deletions

View File

@@ -9,7 +9,15 @@ vi.mock('../../lib/supabase', () => ({
supabase: {
auth: { signOut: vi.fn() },
from: () => ({
select: () => ({ order: () => Promise.resolve({ data: [], error: null }) }),
select: () => ({
order: () => Promise.resolve({ data: [], error: null }),
eq: () => ({
single: () => Promise.resolve({
data: { id: 'default', hero_headline: '', hero_tagline: '', about_bio: '', about_portrait_image: '', contact_email: '', contact_hours: '' },
error: null,
}),
}),
}),
}),
},
}))
@@ -61,4 +69,37 @@ describe('AdminApp routing', () => {
)
expect(await screen.findByRole('heading', { name: /^produits$/i })).toBeInTheDocument()
})
it('renders the AdminContent page at /admin/content', async () => {
render(
<MemoryRouter initialEntries={['/admin/content']}>
<Routes>
<Route path="/admin/*" element={<AdminApp />} />
</Routes>
</MemoryRouter>,
)
expect(await screen.findByRole('heading', { name: /^contenu$/i })).toBeInTheDocument()
})
it('renders the AdminTestimonials page at /admin/testimonials', async () => {
render(
<MemoryRouter initialEntries={['/admin/testimonials']}>
<Routes>
<Route path="/admin/*" element={<AdminApp />} />
</Routes>
</MemoryRouter>,
)
expect(await screen.findByRole('heading', { name: /^témoignages$/i })).toBeInTheDocument()
})
it('renders the AdminRules page at /admin/rules', async () => {
render(
<MemoryRouter initialEntries={['/admin/rules']}>
<Routes>
<Route path="/admin/*" element={<AdminApp />} />
</Routes>
</MemoryRouter>,
)
expect(await screen.findByRole('heading', { name: /^règlements$/i })).toBeInTheDocument()
})
})

View File

@@ -7,6 +7,9 @@ import AdminServices from './AdminServices'
import AdminSchedule from './AdminSchedule'
import AdminBookings from './AdminBookings'
import AdminInquiries from './AdminInquiries'
import AdminContent from './AdminContent'
import AdminTestimonials from './AdminTestimonials'
import AdminRules from './AdminRules'
import styles from './AdminApp.module.css'
function AdminApp() {
@@ -22,6 +25,9 @@ function AdminApp() {
<Route path="schedule" element={<AdminSchedule />} />
<Route path="bookings" element={<AdminBookings />} />
<Route path="inquiries" element={<AdminInquiries />} />
<Route path="content" element={<AdminContent />} />
<Route path="testimonials" element={<AdminTestimonials />} />
<Route path="rules" element={<AdminRules />} />
<Route path="*" element={<Navigate to="/admin/products" replace />} />
</Route>
</Route>

View File

@@ -8,6 +8,9 @@ const NAV_ITEMS = [
{ to: '/admin/schedule', label: 'Horaire' },
{ to: '/admin/bookings', label: 'Réservations' },
{ to: '/admin/inquiries', label: 'Demandes' },
{ to: '/admin/content', label: 'Contenu' },
{ to: '/admin/testimonials', label: 'Témoignages' },
{ to: '/admin/rules', label: 'Règlements' },
]
function AdminLayout() {