Permalink
Browse files

Jest Mocks for NetInfo and Linking

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 0797dae500ecc211e70c08078ac6638e45c50364
Showing with 17 additions and 0 deletions.
  1. +17 −0 jest/setup.js
View
@@ -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(),

0 comments on commit 0797dae

Please sign in to comment.