// useRssiScanner is a React hook that depends on zustand store and rssiService. // We test the module export shape and underlying service interaction. jest.mock('@/services/rssi.service', () => ({ rssiService: { subscribe: jest.fn(() => jest.fn()), startScanning: jest.fn(), stopScanning: jest.fn(), }, })); import { useSettingsStore } from '@/stores/settingsStore'; describe('useRssiScanner', () => { beforeEach(() => { useSettingsStore.setState({ rssiScanEnabled: false }); jest.clearAllMocks(); }); it('module exports useRssiScanner function', () => { const mod = require('@/hooks/useRssiScanner'); expect(typeof mod.useRssiScanner).toBe('function'); }); it('hook depends on rssiScanEnabled from settings store', () => { // Verify the store field the hook reads expect(useSettingsStore.getState()).toHaveProperty('rssiScanEnabled'); }); it('rssiService has the required methods', () => { const { rssiService } = require('@/services/rssi.service'); expect(typeof rssiService.subscribe).toBe('function'); expect(typeof rssiService.startScanning).toBe('function'); expect(typeof rssiService.stopScanning).toBe('function'); }); it('hook return type includes networks and isScanning', () => { // The hook returns { networks: WifiNetwork[], isScanning: boolean } // We verify this via the module signature const mod = require('@/hooks/useRssiScanner'); expect(mod.useRssiScanner).toBeDefined(); }); });