add/fix tests

This commit is contained in:
Jason Hunter 2021-06-05 21:17:51 -04:00 committed by Blake Blackshear
parent 68dfaaf767
commit bbb4d10718

View File

@ -12,8 +12,8 @@ describe('Cameras Route', () => {
useConfigMock = jest.spyOn(Api, 'useConfig').mockImplementation(() => ({ useConfigMock = jest.spyOn(Api, 'useConfig').mockImplementation(() => ({
data: { data: {
cameras: { cameras: {
front: { name: 'front', objects: { track: ['taco', 'cat', 'dog'] } }, front: { name: 'front', objects: { track: ['taco', 'cat', 'dog'] }, record: { enabled: true } },
side: { name: 'side', objects: { track: ['taco', 'cat', 'dog'] } }, side: { name: 'side', objects: { track: ['taco', 'cat', 'dog'] }, record: { enabled: false } },
}, },
}, },
status: 'loaded', status: 'loaded',
@ -41,6 +41,14 @@ describe('Cameras Route', () => {
expect(screen.queryByText('side').closest('a')).toHaveAttribute('href', '/cameras/side'); 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 () => { test('buttons toggle detect, clips, and snapshots', async () => {
const sendDetect = jest.fn(); const sendDetect = jest.fn();
const sendClips = jest.fn(); const sendClips = jest.fn();