Skip to content

Commit

Permalink
add sidebar test
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterjm authored and blakeblackshear committed Jun 6, 2021
1 parent bbb4d10 commit 2a33c05
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions web/src/__tests__/Sidebar.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 } },
},
},
}));
Expand All @@ -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(<Sidebar />);
expect(screen.queryByRole('link', { name: 'front' })).toBeInTheDocument();
expect(screen.queryByRole('link', { name: 'side' })).not.toBeInTheDocument();
});
});

0 comments on commit 2a33c05

Please sign in to comment.