From 2a33c05378765cc531c42c5faf1d0b01727a1af0 Mon Sep 17 00:00:00 2001 From: Jason Hunter Date: Sat, 5 Jun 2021 21:20:00 -0400 Subject: [PATCH] add sidebar test --- web/src/__tests__/Sidebar.test.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web/src/__tests__/Sidebar.test.jsx b/web/src/__tests__/Sidebar.test.jsx index a2098f898..a90d8c253 100644 --- a/web/src/__tests__/Sidebar.test.jsx +++ b/web/src/__tests__/Sidebar.test.jsx @@ -9,8 +9,8 @@ describe('Sidebar', () => { jest.spyOn(Api, 'useConfig').mockImplementation(() => ({ data: { cameras: { - front: { name: 'front', objects: { track: ['taco', 'cat', 'dog'] } }, - side: { name: 'side', objects: { track: ['taco', 'cat', 'dog'] } }, + front: { name: 'front', objects: { track: ['taco', 'cat', 'dog'] }, record: { enabled: true } }, + side: { name: 'side', objects: { track: ['taco', 'cat', 'dog'] }, record: { enabled: false } }, }, }, })); @@ -30,4 +30,11 @@ describe('Sidebar', () => { expect(screen.queryByRole('link', { name: 'front' })).toBeInTheDocument(); expect(screen.queryByRole('link', { name: 'side' })).toBeInTheDocument(); }); + + test('render cameras if in camera route', async () => { + window.history.replaceState({}, 'Front Recordings', '/recording/front'); + render(); + expect(screen.queryByRole('link', { name: 'front' })).toBeInTheDocument(); + expect(screen.queryByRole('link', { name: 'side' })).not.toBeInTheDocument(); + }); });