feat: wire AdminContent/AdminTestimonials/AdminRules into admin nav and routes
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user