diff --git a/frontend/src/components/modals/__tests__/SettingsModal.test.tsx b/frontend/src/components/modals/__tests__/SettingsModal.test.tsx index 41f34fb..14b0dbc 100644 --- a/frontend/src/components/modals/__tests__/SettingsModal.test.tsx +++ b/frontend/src/components/modals/__tests__/SettingsModal.test.tsx @@ -131,6 +131,9 @@ describe('SettingsModal', () => { vi.mocked(proxmoxApi.saveConfig).mockResolvedValue({ data: {} } as never) render() await screen.findByDisplayValue('60') + // Wait for the async proxmox getConfig to hydrate the toggle before saving — + // otherwise Save can fire with the default sync_enabled=false under CI load. + await waitFor(() => expect(screen.getByLabelText('Toggle Proxmox auto-sync')).toBeChecked()) fireEvent.click(screen.getByRole('button', { name: 'Save' })) await waitFor(() => { expect(proxmoxApi.saveConfig).toHaveBeenCalledWith({ sync_enabled: true, sync_interval: 3600 }) @@ -174,6 +177,9 @@ describe('SettingsModal', () => { render() await screen.findByDisplayValue('60') await screen.findByText('Zigbee auto-sync') + // Wait for the async zigbee getConfig to hydrate the toggle before saving — + // otherwise Save can fire with the default sync_enabled=false under CI load. + await waitFor(() => expect(screen.getByLabelText('Toggle Zigbee auto-sync')).toBeChecked()) fireEvent.click(screen.getByRole('button', { name: 'Save' })) await waitFor(() => { expect(zigbeeApi.saveConfig).toHaveBeenCalledWith({ sync_enabled: true, sync_interval: 1800 })