fix(web): address strict mode review feedback

This commit is contained in:
4gray committed 2026-05-22 03:11:14 +03:00
1 parent 4ab8915483
commit 5d355b6f10
7 files changed
+53 -13

No files matched your search

@@ -494,7 +494,9 @@ describe('SettingsComponent', () => {
.some((player) => player.id === VideoPlayer.EmbeddedMpv)
).toBe(false);
expect(resolveSupport).toBeDefined();
if (!resolveSupport) {
throw new Error('Expected embedded MPV support resolver');
}
resolveSupport({
supported: true,
platform: 'darwin',
@@ -983,4 +985,39 @@ describe('SettingsComponent', () => {
})
);
});
it('preserves saved EPG settings when saving from the web settings form', async () => {
fixture.destroy();
window.electron = undefined as unknown as typeof window.electron;
const mockStore = settingsStore as unknown as MockSettingsStore;
mockStore._setSettings({
epgUrl: ['https://example.com/guide.xml'],
preferUploadedEpgOverXtream: true,
});
mockStore.updateSettings.mockResolvedValue(undefined);
const webFixture = TestBed.createComponent(SettingsComponent);
const webComponent = webFixture.componentInstance;
webComponent.checkAppVersion = jest.fn();
webComponent.fetchLocalIpAddresses = jest
.fn()
.mockResolvedValue(undefined);
webFixture.detectChanges();
await webFixture.whenStable();
webComponent.settingsForm.patchValue({ theme: Theme.DarkTheme });
webComponent.onSubmit();
await webFixture.whenStable();
expect(mockStore.updateSettings).toHaveBeenCalledWith(
expect.objectContaining({
epgUrl: ['https://example.com/guide.xml'],
preferUploadedEpgOverXtream: true,
theme: Theme.DarkTheme,
})
);
webFixture.destroy();
});
});