From 165f87673002dec640fe86486296cd0d0847b333 Mon Sep 17 00:00:00 2001 From: Tim Wang Date: Wed, 6 Sep 2017 23:44:19 -0700 Subject: [PATCH] Add BlobModule native module mock to jest setup Summary: React Native v0.48.0 shipped `WebSocketModule` support with `BlobModule` as dependency. But `BlobModule` is not mocked in jest which will cause render tests failed. Reference implantation: [BlobModule.java](https://github.com/facebook/react-native/blob/ed903099b42259958d8a6eb3af1a6460c1bc8b2c/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.java) Related PR: #11417 Related issue: #15810 Passed CI tests. Need render a component in jest with WebSocketModule as dependency. Closes https://github.com/facebook/react-native/pull/15843 Differential Revision: D5783263 Pulled By: shergin fbshipit-source-id: 2386692f4a644796da2fd66b3135da9f5911663e --- jest/setup.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jest/setup.js b/jest/setup.js index 8a9251ec6..819b40c27 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -275,6 +275,15 @@ const mockNativeModules = { Constants: {}, }, }, + BlobModule: { + BLOB_URI_SCHEME: 'content', + BLOB_URI_HOST: null, + enableBlobSupport: jest.fn(), + disableBlobSupport: jest.fn(), + createFromParts: jest.fn(), + sendBlob: jest.fn(), + release: jest.fn(), + }, WebSocketModule: { connect: jest.fn(), send: jest.fn(),