Skip to content

Commit

Permalink
Add missing mock for AppState
Browse files Browse the repository at this point in the history
Summary:
**Description**

In the same vein as #11198, this adds a mock for the native module `AppState`.

**Test plan**

Create a component that uses `AppState`, e.g.

```jsx
import React, { Component } from 'react';
import { AppState } from 'react-native';

class TestComponent extends Component {
  componentDidMount() {
    AppState.addEventListener('change', this.stateChangeListener);
  }
}
```
Closes #11199

Differential Revision: D4246668

Pulled By: cpojer

fbshipit-source-id: e3a73a98963a0e152a70aba78ef3461b86da0f6c
  • Loading branch information
cooperka authored and Facebook Github Bot committed Nov 29, 2016
1 parent 20e99f5 commit 00f888a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ const mockNativeModules = {
AlertManager: {
alertWithArgs: jest.fn(),
},
AppState: {
addEventListener: jest.fn(),
},
AsyncLocalStorage: {
clear: jest.fn(),
getItem: jest.fn(),
Expand Down

0 comments on commit 00f888a

Please sign in to comment.