mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Fix tests
This commit is contained in:
parent
2a2adfaf20
commit
c82f5240b6
@ -11,7 +11,7 @@ describe('Camera Route', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockSetOptions = jest.fn();
|
mockSetOptions = jest.fn();
|
||||||
mockUsePersistence = jest.spyOn(Context, 'usePersistence').mockImplementation(() => [{}, mockSetOptions]);
|
mockUsePersistence = jest.spyOn(Context, 'usePersistence').mockImplementation(() => [{}, mockSetOptions, true]);
|
||||||
jest.spyOn(AutoUpdatingCameraImage, 'default').mockImplementation(({ searchParams }) => {
|
jest.spyOn(AutoUpdatingCameraImage, 'default').mockImplementation(({ searchParams }) => {
|
||||||
return <div data-testid="mock-image">{searchParams.toString()}</div>;
|
return <div data-testid="mock-image">{searchParams.toString()}</div>;
|
||||||
});
|
});
|
||||||
@ -32,11 +32,12 @@ describe('Camera Route', () => {
|
|||||||
regions: false,
|
regions: false,
|
||||||
},
|
},
|
||||||
mockSetOptions,
|
mockSetOptions,
|
||||||
|
true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
render(<Camera camera="front" />);
|
render(<Camera camera="front" />);
|
||||||
|
|
||||||
await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading…'));
|
await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading…'), { timeout: 10 });
|
||||||
|
|
||||||
fireEvent.click(screen.queryByText('Debug'));
|
fireEvent.click(screen.queryByText('Debug'));
|
||||||
fireEvent.click(screen.queryByText('Show Options'));
|
fireEvent.click(screen.queryByText('Show Options'));
|
||||||
@ -47,20 +48,20 @@ describe('Camera Route', () => {
|
|||||||
|
|
||||||
test('updates camera feed options to persistence', async () => {
|
test('updates camera feed options to persistence', async () => {
|
||||||
mockUsePersistence
|
mockUsePersistence
|
||||||
.mockReturnValueOnce([{}, mockSetOptions])
|
.mockReturnValueOnce([{}, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{}, mockSetOptions])
|
.mockReturnValueOnce([{}, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{}, mockSetOptions])
|
.mockReturnValueOnce([{}, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{}, mockSetOptions])
|
.mockReturnValueOnce([{}, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{}, mockSetOptions])
|
.mockReturnValueOnce([{}, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{}, mockSetOptions])
|
.mockReturnValueOnce([{}, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{}, mockSetOptions])
|
.mockReturnValueOnce([{}, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{}, mockSetOptions])
|
.mockReturnValueOnce([{}, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{ bbox: true }, mockSetOptions])
|
.mockReturnValueOnce([{ bbox: true }, mockSetOptions, true])
|
||||||
.mockReturnValueOnce([{ bbox: true, timestamp: true }, mockSetOptions]);
|
.mockReturnValueOnce([{ bbox: true, timestamp: true }, mockSetOptions, true]);
|
||||||
|
|
||||||
render(<Camera camera="front" />);
|
render(<Camera camera="front" />);
|
||||||
|
|
||||||
await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading…'));
|
await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading…'), { timeout: 10 });
|
||||||
|
|
||||||
fireEvent.click(screen.queryByText('Debug'));
|
fireEvent.click(screen.queryByText('Debug'));
|
||||||
fireEvent.click(screen.queryByText('Show Options'));
|
fireEvent.click(screen.queryByText('Show Options'));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user