controller: address hotspot protocol review findings
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Controller Tests / controller-tests (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

- Reset a saved protocol the newly probed device does not support
  instead of offering it (both UIs); a successful probe is
  authoritative, the saved value is only kept when probing fails.
- Ignore out-of-order protocol probe responses when switching devices
  quickly (both UIs).
- Verify the WPA2 rollback after a failed WPA3 activation; report that
  the hotspot may be down instead of claiming the revert succeeded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-28 20:59:10 -06:00
parent 8687816b84
commit 2baa9cbd2e
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
5 changed files with 67 additions and 12 deletions

View file

@ -208,6 +208,19 @@ describe('ControllerPage', () => {
});
});
test('a saved protocol the device does not support is reset to a supported one', async () => {
const controllerApi = require('../../api/controller');
controllerApi.getHotspotSettings.mockResolvedValue(
{device: 'wlan0', ssid: 'WROLPi', password: 'wrolpi hotspot', protocol: 'wpa3'});
controllerApi.getHotspotProtocols.mockResolvedValue({device: 'wlan0', protocols: ['wpa2']});
renderControllerPage();
// The stale WPA3 selection is replaced by the only protocol the device supports.
await waitFor(() => {
expect(screen.getAllByText('WPA2 (most compatible)').length).toBeGreaterThan(0);
});
expect(screen.queryByText('WPA3')).not.toBeInTheDocument();
});
test('hotspot protocol dropdown only offers WPA2 on a Raspberry Pi', async () => {
const {getHotspotProtocols} = require('../../api/controller');
getHotspotProtocols.mockResolvedValue({device: 'wlan0', protocols: ['wpa2']});