1import { Platform, StatusBar as ReactNativeStatusBar } from 'react-native'; 2 3import { mockProperty, mockAppearance } from './Helpers'; 4import { setStatusBarStyle } from '../StatusBar'; 5 6if (Platform.OS === 'web') { 7 describe('setStatusBarStyle', () => { 8 it('delegates to the React Native StatusBar equivalent and assumes light theme', () => { 9 const mock = jest.fn(); 10 mockProperty(ReactNativeStatusBar, 'setBarStyle', mock, () => { 11 setStatusBarStyle('auto'); 12 expect(mock).toHaveBeenCalledWith('dark-content', undefined); 13 }); 14 }); 15 }); 16} else { 17 describe('setStatusBarStyle', () => { 18 it('delegates to the React Native StatusBar equivalent and remaps style to barStyle', () => { 19 const mock = jest.fn(); 20 mockProperty(ReactNativeStatusBar, 'setBarStyle', mock, () => { 21 mockAppearance('dark', () => { 22 setStatusBarStyle('auto'); 23 expect(mock).toHaveBeenCalledWith('light-content', undefined); 24 }); 25 }); 26 }); 27 28 it('delegates to the React Native StatusBar equivalent, remaps style to barStyle and passes animated value correctly', () => { 29 const mock = jest.fn(); 30 mockProperty(ReactNativeStatusBar, 'setBarStyle', mock, () => { 31 mockAppearance('dark', () => { 32 setStatusBarStyle('auto', true); 33 expect(mock).toHaveBeenCalledWith('light-content', true); 34 }); 35 }); 36 }); 37 }); 38} 39