Ensure timeline menu buttons shows up when it should.

This commit is contained in:
Dermot Duffy
2024-03-09 19:57:14 -08:00
parent e4783681d6
commit 6ed1c90554
7 changed files with 1208 additions and 1070 deletions
+5 -26
View File
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { afterAll, describe, expect, it, vi } from 'vitest';
import { mock } from 'vitest-mock-extended';
import {
@@ -382,6 +383,7 @@ describe('ActionsManager.executeAction', () => {
expect.objectContaining({
viewName: 'live',
cameraID: 'camera',
failSafe: true,
}),
);
});
@@ -409,6 +411,7 @@ describe('ActionsManager.executeAction', () => {
expect.objectContaining({
viewName: 'timeline',
cameraID: 'camera',
failSafe: true,
}),
);
});
@@ -442,6 +445,7 @@ describe('ActionsManager.executeAction', () => {
expect.objectContaining({
viewName: 'clips',
cameraID: 'camera',
failSafe: true,
}),
);
});
@@ -467,6 +471,7 @@ describe('ActionsManager.executeAction', () => {
expect.objectContaining({
viewName: 'live',
cameraID: 'camera',
failSafe: true,
}),
);
});
@@ -503,32 +508,6 @@ describe('ActionsManager.executeAction', () => {
expect(api.getViewManager().setViewByParameters).not.toBeCalled();
});
it('with an unsupported view', async () => {
const api = createCardAPI();
const manager = new ActionsManager(api);
vi.mocked(api.getViewManager().getView).mockReturnValue(
createView({
view: 'timeline',
}),
);
await manager.executeFrigateAction(
createAction({
frigate_card_action: 'camera_select',
camera: 'camera',
})!,
);
expect(api.getViewManager().setViewByParameters).toBeCalledWith(
expect.objectContaining({
// Should have fallen back to the default view.
viewName: 'live',
cameraID: 'camera',
}),
);
});
});
it('should handle live_substream_select action', async () => {