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
This commit is contained in:
Dermot Duffy
2024-09-22 15:08:37 -07:00
committed by GitHub
parent a4417e8a3d
commit 766f3422a9
20 changed files with 137 additions and 88 deletions
@@ -218,6 +218,24 @@ describe('ConfigManager', () => {
expect(manager.getConfig()).not.toEqual(manager.getNonOverriddenConfig());
});
it('should set error on invalid override', () => {
const api = createCardAPI();
const manager = new ConfigManager(api);
manager.setConfig({
type: 'custom:frigate-card',
cameras: [{ camera_entity: 'camera.office' }],
});
const error = new Error('Invalid override configuration');
vi.mocked(getOverriddenConfig).mockImplementation(() => {
throw error;
});
manager.computeOverrideConfig();
expect(api.getMessageManager().setErrorIfHigherPriority).toBeCalledWith(error);
});
describe('should uninitialize on override', () => {
it('cameras', () => {
const api = createCardAPI();