|
1 | 1 | import { getDefaultStatusBarStyle, getDefaultStatusBarBackgroundColor } from '../constants'; |
2 | 2 |
|
3 | | -test('StatusBarDefaultBarStyle to be default', () => { |
4 | | - const barStyle = getDefaultStatusBarStyle(); |
5 | | - expect(barStyle).toBe('default'); |
6 | | -}); |
7 | | -test('StatusBarDefaultBackgroundColor to be black', () => { |
8 | | - const backgroundColor = getDefaultStatusBarBackgroundColor(); |
9 | | - expect(backgroundColor).toBe('black'); |
10 | | -}); |
11 | | -test('StatusBarDefaultBarStyle to be StatusBar._defaultProps.barStyle.value', () => { |
12 | | - const { StatusBar } = require('react-native'); |
13 | | - const barStyle = getDefaultStatusBarStyle(); |
14 | | - expect(barStyle).toBe(StatusBar._defaultProps.barStyle.value); |
15 | | -}); |
16 | | -test('StatusBarDefaultBackgroundColor to be StatusBar._defaultProps.backgroundColor.value', () => { |
17 | | - const { StatusBar } = require('react-native'); |
18 | | - const backgroundColor = getDefaultStatusBarBackgroundColor(); |
19 | | - expect(backgroundColor).toBe(StatusBar._defaultProps.backgroundColor.value); |
| 3 | +describe('Constants', () => { |
| 4 | + describe('Mock StatusBar with no _defaultProps property', () => { |
| 5 | + beforeEach(() => { |
| 6 | + jest.mock('StatusBar', () => { |
| 7 | + return {}; |
| 8 | + }); |
| 9 | + }); |
| 10 | + test('StatusBarDefaultBarStyle to be default', () => { |
| 11 | + const barStyle = getDefaultStatusBarStyle(); |
| 12 | + expect(barStyle).toBe('default'); |
| 13 | + }); |
| 14 | + test('StatusBarDefaultBackgroundColor to be black', () => { |
| 15 | + const backgroundColor = getDefaultStatusBarBackgroundColor(); |
| 16 | + expect(backgroundColor).toBe('black'); |
| 17 | + }); |
| 18 | + }); |
| 19 | + describe('StatusBar with _defaultProps property', () => { |
| 20 | + const { StatusBar } = require('react-native'); |
| 21 | + test('StatusBarDefaultBarStyle to be StatusBar._defaultProps.barStyle.value', () => { |
| 22 | + const barStyle = getDefaultStatusBarStyle(); |
| 23 | + expect(barStyle).toBe(StatusBar._defaultProps.barStyle.value); |
| 24 | + }); |
| 25 | + test('StatusBarDefaultBackgroundColor to be StatusBar._defaultProps.backgroundColor.value', () => { |
| 26 | + const backgroundColor = getDefaultStatusBarBackgroundColor(); |
| 27 | + expect(backgroundColor).toBe(StatusBar._defaultProps.backgroundColor.value); |
| 28 | + }); |
| 29 | + }); |
20 | 30 | }); |
0 commit comments