mirror of
https://github.com/status-im/react-native.git
synced 2025-01-12 18:44:25 +00:00
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(
|
canOpenURL: jest.fn(
|
||||||
() => new Promise((resolve) => resolve(true))
|
() => new Promise((resolve) => resolve(true))
|
||||||
),
|
),
|
||||||
|
addEventListener: jest.fn(),
|
||||||
|
getInitialURL: jest.fn(
|
||||||
|
() => new Promise((resolve) => resolve())
|
||||||
|
),
|
||||||
|
removeEventListener: jest.fn(),
|
||||||
},
|
},
|
||||||
LocationObserver: {
|
LocationObserver: {
|
||||||
getCurrentPosition: jest.fn(),
|
getCurrentPosition: jest.fn(),
|
||||||
@ -150,6 +155,18 @@ const mockNativeModules = {
|
|||||||
stopObserving: jest.fn(),
|
stopObserving: jest.fn(),
|
||||||
},
|
},
|
||||||
ModalFullscreenViewManager: {},
|
ModalFullscreenViewManager: {},
|
||||||
|
NetInfo: {
|
||||||
|
fetch: jest.fn(
|
||||||
|
() => new Promise((resolve) => resolve())
|
||||||
|
),
|
||||||
|
addEventListener: jest.fn(),
|
||||||
|
isConnected: {
|
||||||
|
fetch: jest.fn(
|
||||||
|
() => new Promise((resolve) => resolve())
|
||||||
|
),
|
||||||
|
addEventListener: jest.fn(),
|
||||||
|
},
|
||||||
|
},
|
||||||
Networking: {
|
Networking: {
|
||||||
sendRequest: jest.fn(),
|
sendRequest: jest.fn(),
|
||||||
abortRequest: jest.fn(),
|
abortRequest: jest.fn(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user