Skip to content

Commit

Permalink
Jest Mocks for NetInfo and Linking
Browse files Browse the repository at this point in the history
Summary:
This isn't exhaustive, but it's a few more functions that these modules normally export which need to be stubbed.
Closes #14432

Differential Revision: D5345928

Pulled By: shergin

fbshipit-source-id: f333056ac43ce7c75c6734bca8dc9035745721df
  • Loading branch information
hnryjms authored and facebook-github-bot committed Jun 29, 2017
1 parent 1859486 commit 0797dae
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions jest/setup.js
Expand Up @@ -143,13 +143,30 @@ const mockNativeModules = {
canOpenURL: jest.fn(
() => new Promise((resolve) => resolve(true))
),
addEventListener: jest.fn(),
getInitialURL: jest.fn(
() => new Promise((resolve) => resolve())
),
removeEventListener: jest.fn(),
},
LocationObserver: {
getCurrentPosition: jest.fn(),
startObserving: jest.fn(),
stopObserving: jest.fn(),
},
ModalFullscreenViewManager: {},
NetInfo: {
fetch: jest.fn(
() => new Promise((resolve) => resolve())
),
addEventListener: jest.fn(),
isConnected: {
fetch: jest.fn(
() => new Promise((resolve) => resolve())
),
addEventListener: jest.fn(),
},
},
Networking: {
sendRequest: jest.fn(),
abortRequest: jest.fn(),
Expand Down

0 comments on commit 0797dae

Please sign in to comment.