Add support for configuration profiles.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { ProfileType } from '../../../src/config/types';
|
||||
import { setProfiles } from '../../../src/config/profiles';
|
||||
import { createConfig } from '../../test-utils';
|
||||
|
||||
describe('setProfiles', () => {
|
||||
it('should handle failed parse', () => {
|
||||
expect(setProfiles({ cameras: 'not_an_array' }, {})).toEqual({});
|
||||
});
|
||||
|
||||
it('should handle no profiles', () => {
|
||||
const input = createConfig();
|
||||
const output = createConfig();
|
||||
|
||||
expect(setProfiles(input, output)).toEqual(input);
|
||||
});
|
||||
|
||||
it('should handle invalid profiles', () => {
|
||||
const input = createConfig();
|
||||
const output = createConfig();
|
||||
|
||||
expect(setProfiles(input, output, ['bogus' as ProfileType])).toEqual(input);
|
||||
});
|
||||
|
||||
it('should handle profiles', () => {
|
||||
const input = {
|
||||
type: 'frigate-hass-card',
|
||||
cameras: [],
|
||||
live: {
|
||||
controls: {
|
||||
timeline: {
|
||||
// This will not be overridden.
|
||||
style: 'stack',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
expect(setProfiles(input, {}, ['scrubbing'])).toEqual({
|
||||
live: {
|
||||
controls: {
|
||||
timeline: {
|
||||
mode: 'below',
|
||||
pan_mode: 'seek',
|
||||
},
|
||||
},
|
||||
},
|
||||
media_viewer: {
|
||||
controls: {
|
||||
timeline: {
|
||||
mode: 'below',
|
||||
style: 'ribbon',
|
||||
pan_mode: 'seek',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
import { expect, it } from 'vitest';
|
||||
import { LOW_PERFORMANCE_PROFILE } from '../../../src/config/profiles/low-performance';
|
||||
|
||||
it('low performance profile', () => {
|
||||
expect(LOW_PERFORMANCE_PROFILE).toEqual({
|
||||
'cameras_global.image.refresh_seconds': 10,
|
||||
'cameras_global.live_provider': 'image',
|
||||
'cameras_global.triggers.occupancy': false,
|
||||
'live.auto_mute': 'never',
|
||||
'live.controls.thumbnails.mode': 'none',
|
||||
'live.controls.thumbnails.show_details': false,
|
||||
'live.controls.thumbnails.show_download_control': false,
|
||||
'live.controls.thumbnails.show_favorite_control': false,
|
||||
'live.controls.thumbnails.show_timeline_control': false,
|
||||
'live.controls.timeline.show_recordings': false,
|
||||
'live.controls.title.mode': 'none',
|
||||
'live.draggable': false,
|
||||
'live.lazy_unload': 'all',
|
||||
'live.show_image_during_load': false,
|
||||
'live.transition_effect': 'none',
|
||||
'media_gallery.controls.thumbnails.show_details': false,
|
||||
'media_gallery.controls.thumbnails.show_download_control': false,
|
||||
'media_gallery.controls.thumbnails.show_favorite_control': false,
|
||||
'media_gallery.controls.thumbnails.show_timeline_control': false,
|
||||
'media_viewer.auto_mute': 'never',
|
||||
'media_viewer.auto_pause': 'never',
|
||||
'media_viewer.auto_play': 'never',
|
||||
'media_viewer.controls.next_previous.style': 'chevrons',
|
||||
'media_viewer.controls.thumbnails.mode': 'none',
|
||||
'media_viewer.controls.thumbnails.show_details': false,
|
||||
'media_viewer.controls.thumbnails.show_download_control': false,
|
||||
'media_viewer.controls.thumbnails.show_favorite_control': false,
|
||||
'media_viewer.controls.thumbnails.show_timeline_control': false,
|
||||
'media_viewer.controls.timeline.show_recordings': false,
|
||||
'media_viewer.controls.title.mode': 'none',
|
||||
'media_viewer.draggable': false,
|
||||
'media_viewer.snapshot_click_plays_clip': false,
|
||||
'media_viewer.transition_effect': 'none',
|
||||
'menu.buttons.frigate.enabled': false,
|
||||
'menu.buttons.media_player.enabled': false,
|
||||
'menu.buttons.timeline.enabled': false,
|
||||
'menu.style': 'outside',
|
||||
'performance.features.animated_progress_indicator': false,
|
||||
'performance.features.media_chunk_size': 10,
|
||||
'performance.style.border_radius': false,
|
||||
'performance.style.box_shadow': false,
|
||||
'timeline.controls.thumbnails.mode': 'none',
|
||||
'timeline.controls.thumbnails.show_details': false,
|
||||
'timeline.controls.thumbnails.show_download_control': false,
|
||||
'timeline.controls.thumbnails.show_favorite_control': false,
|
||||
'timeline.controls.thumbnails.show_timeline_control': false,
|
||||
'timeline.show_recordings': false,
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { expect, it } from 'vitest';
|
||||
import { SCRUBBING_PROFILE } from '../../../src/config/profiles/scrubbing';
|
||||
|
||||
it('scrubbing profile', () => {
|
||||
expect(SCRUBBING_PROFILE).toEqual({
|
||||
'live.controls.timeline.mode': 'below',
|
||||
'live.controls.timeline.style': 'ribbon',
|
||||
'live.controls.timeline.pan_mode': 'seek',
|
||||
'media_viewer.controls.timeline.mode': 'below',
|
||||
'media_viewer.controls.timeline.style': 'ribbon',
|
||||
'media_viewer.controls.timeline.pan_mode': 'seek',
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user