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 https://github.com/facebook/react-native/pull/14432 Differential Revision: D5345928 Pulled By: shergin fbshipit-source-id: f333056ac43ce7c75c6734bca8dc9035745721df
This commit is contained in:
parent
185948604c
commit
0797dae500
|
@ -143,6 +143,11 @@ 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(),
|
||||
|
@ -150,6 +155,18 @@ const mockNativeModules = {
|
|||
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(),
|
||||
|
|
Loading…
Reference in New Issue