// Mock react-native BEFORE importing the SDK — `../Nami` resolves // the native module via TurboModuleRegistry at import time. const configure = jest.fn().mockResolvedValue({ success: true }); const sdkConfigured = jest.fn().mockResolvedValue(false); jest.mock('react-native', () => ({ TurboModuleRegistry: { getEnforcing: jest.fn(() => ({ configure, sdkConfigured })), }, NativeModules: { RNNami: { configure, sdkConfigured }, }, })); import { Nami } from '../Nami'; describe('Nami.configure formFactor override (NAM-3588)', () => { beforeEach(() => { configure.mockClear(); }); it('passes formFactor through to the native configure call', async () => { await Nami.configure({ appPlatformID: 'app-platform-id', logLevel: 'DEBUG', formFactor: 'television', }); expect(configure).toHaveBeenCalledTimes(1); expect(configure.mock.calls[0][0]).toMatchObject({ appPlatformID: 'app-platform-id', formFactor: 'television', }); }); it('omits formFactor when the app does not set one', async () => { await Nami.configure({ appPlatformID: 'app-platform-id', logLevel: 'DEBUG', }); expect(configure.mock.calls[0][0]).not.toHaveProperty('formFactor'); }); });