Skip to content

Commit

Permalink
add/fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterjm authored and blakeblackshear committed Jun 6, 2021
1 parent 68dfaaf commit bbb4d10
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions web/src/routes/__tests__/Cameras.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ describe('Cameras Route', () => {
useConfigMock = 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 } },
},
},
status: 'loaded',
Expand Down Expand Up @@ -41,6 +41,14 @@ describe('Cameras Route', () => {
expect(screen.queryByText('side').closest('a')).toHaveAttribute('href', '/cameras/side');
});

test('shows recordings link', async () => {
render(<Cameras />);

expect(screen.queryByLabelText('Loading…')).not.toBeInTheDocument();

expect(screen.queryAllByText('Recordings')).toHaveLength(1);
});

test('buttons toggle detect, clips, and snapshots', async () => {
const sendDetect = jest.fn();
const sendClips = jest.fn();
Expand Down

0 comments on commit bbb4d10

Please sign in to comment.