From c82f5240b65851c66817d3e21e4a477a1763b4e8 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Mon, 24 Oct 2022 15:52:18 -0600 Subject: [PATCH] Fix tests --- web/src/routes/__tests__/Camera.test.jsx | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/web/src/routes/__tests__/Camera.test.jsx b/web/src/routes/__tests__/Camera.test.jsx index 2bdd6c3a2..db5576d70 100644 --- a/web/src/routes/__tests__/Camera.test.jsx +++ b/web/src/routes/__tests__/Camera.test.jsx @@ -11,7 +11,7 @@ describe('Camera Route', () => { beforeEach(() => { mockSetOptions = jest.fn(); - mockUsePersistence = jest.spyOn(Context, 'usePersistence').mockImplementation(() => [{}, mockSetOptions]); + mockUsePersistence = jest.spyOn(Context, 'usePersistence').mockImplementation(() => [{}, mockSetOptions, true]); jest.spyOn(AutoUpdatingCameraImage, 'default').mockImplementation(({ searchParams }) => { return
{searchParams.toString()}
; }); @@ -32,11 +32,12 @@ describe('Camera Route', () => { regions: false, }, mockSetOptions, + true, ]); render(); - await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading…')); + await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading…'), { timeout: 10 }); fireEvent.click(screen.queryByText('Debug')); fireEvent.click(screen.queryByText('Show Options')); @@ -47,20 +48,20 @@ describe('Camera Route', () => { test('updates camera feed options to persistence', async () => { mockUsePersistence - .mockReturnValueOnce([{}, mockSetOptions]) - .mockReturnValueOnce([{}, mockSetOptions]) - .mockReturnValueOnce([{}, mockSetOptions]) - .mockReturnValueOnce([{}, mockSetOptions]) - .mockReturnValueOnce([{}, mockSetOptions]) - .mockReturnValueOnce([{}, mockSetOptions]) - .mockReturnValueOnce([{}, mockSetOptions]) - .mockReturnValueOnce([{}, mockSetOptions]) - .mockReturnValueOnce([{ bbox: true }, mockSetOptions]) - .mockReturnValueOnce([{ bbox: true, timestamp: true }, mockSetOptions]); + .mockReturnValueOnce([{}, mockSetOptions, true]) + .mockReturnValueOnce([{}, mockSetOptions, true]) + .mockReturnValueOnce([{}, mockSetOptions, true]) + .mockReturnValueOnce([{}, mockSetOptions, true]) + .mockReturnValueOnce([{}, mockSetOptions, true]) + .mockReturnValueOnce([{}, mockSetOptions, true]) + .mockReturnValueOnce([{}, mockSetOptions, true]) + .mockReturnValueOnce([{}, mockSetOptions, true]) + .mockReturnValueOnce([{ bbox: true }, mockSetOptions, true]) + .mockReturnValueOnce([{ bbox: true, timestamp: true }, mockSetOptions, true]); render(); - await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading…')); + await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading…'), { timeout: 10 }); fireEvent.click(screen.queryByText('Debug')); fireEvent.click(screen.queryByText('Show Options'));