Files
advanced-camera-card/tests/config/profiles/scrubbing.test.ts
T
Dermot Duffy 766f3422a9 fix: Unparseable config when using the low-performance profile (#1570)
* The `low-performance` profile itself had parse errors: fix them!
* Do not silently swallow override parse errors, they are always a user issue
* Minor error message rendering improvements to show multiple pieces of context
2024-09-22 15:08:37 -07:00

28 lines
1.1 KiB
TypeScript

import { expect, it } from 'vitest';
import { SCRUBBING_PROFILE } from '../../../src/config/profiles/scrubbing';
import { setProfiles } from '../../../src/config/profiles';
import { frigateCardConfigSchema } from '../../../src/config/types';
import { createRawConfig } from '../../test-utils';
it('should contain expected defaults', () => {
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',
});
});
it('should be parseable after application', () => {
const rawInputConfig = createRawConfig();
const parsedConfig = frigateCardConfigSchema.parse(rawInputConfig);
setProfiles(rawInputConfig, parsedConfig, ['low-performance']);
// Reparse the config to ensure the profile did not introduce errors.
const parseResult = frigateCardConfigSchema.safeParse(parsedConfig);
expect(parseResult.success, parseResult.error?.toString()).toBeTruthy();
});