From 99b81da6292fcec0d7a375e4f606f85214e20987 Mon Sep 17 00:00:00 2001 From: Alex Kotliarskyi Date: Thu, 26 Jan 2017 11:22:45 -0800 Subject: [PATCH] Remove obsolete mocks Reviewed By: cpojer Differential Revision: D4466121 fbshipit-source-id: a318deb6485cb3e2e8e7bd52278bce9f9d16fefd --- .../BatchedBridge/__mocks__/NativeModules.js | 76 ------------------- .../InitializeJavaScriptAppEngine.js | 14 ---- .../native/__mocks__/RCTEventEmitter.js | 16 ---- .../native/__mocks__/TextInputState.js | 17 ----- .../renderers/native/__mocks__/UIManager.js | 23 ------ .../src/renderers/native/__mocks__/View.js | 19 ----- .../renderers/native/__mocks__/deepDiffer.js | 63 --------------- .../deepFreezeAndThrowOnMutationInDev.js | 16 ---- .../native/__mocks__/flattenStyle.js | 16 ---- 9 files changed, 260 deletions(-) delete mode 100644 Libraries/BatchedBridge/__mocks__/NativeModules.js delete mode 100644 Libraries/Renderer/src/renderers/native/__mocks__/InitializeJavaScriptAppEngine.js delete mode 100644 Libraries/Renderer/src/renderers/native/__mocks__/RCTEventEmitter.js delete mode 100644 Libraries/Renderer/src/renderers/native/__mocks__/TextInputState.js delete mode 100644 Libraries/Renderer/src/renderers/native/__mocks__/UIManager.js delete mode 100644 Libraries/Renderer/src/renderers/native/__mocks__/View.js delete mode 100644 Libraries/Renderer/src/renderers/native/__mocks__/deepDiffer.js delete mode 100644 Libraries/Renderer/src/renderers/native/__mocks__/deepFreezeAndThrowOnMutationInDev.js delete mode 100644 Libraries/Renderer/src/renderers/native/__mocks__/flattenStyle.js diff --git a/Libraries/BatchedBridge/__mocks__/NativeModules.js b/Libraries/BatchedBridge/__mocks__/NativeModules.js deleted file mode 100644 index 7dfef4b19..000000000 --- a/Libraries/BatchedBridge/__mocks__/NativeModules.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ -'use strict'; - -var NativeModules = { - I18n: { - translationsDictionary: JSON.stringify({ - 'Good bye, {name}!|Bye message': '¡Adiós {name}!', - }), - }, - Timing: { - createTimer: jest.fn(), - deleteTimer: jest.fn(), - }, - GraphPhotoUpload: { - upload: jest.fn(), - }, - FacebookSDK: { - login: jest.fn(), - logout: jest.fn(), - queryGraphPath: jest.fn((path, method, params, callback) => callback()), - }, - DataManager: { - queryData: jest.fn(), - }, - UIManager: { - customBubblingEventTypes: {}, - customDirectEventTypes: {}, - Dimensions: { - window: { - width: 750, - height: 1334, - scale: 2, - fontScale: 2, - } - }, - RCTModalFullscreenView: { - Constants: {}, - }, - RCTScrollView: { - Constants: {}, - }, - }, - AsyncLocalStorage: { - getItem: jest.fn(), - setItem: jest.fn(), - removeItem: jest.fn(), - clear: jest.fn(), - }, - SourceCode: { - scriptURL: null, - }, - BuildInfo: { - appVersion: '0', - buildVersion: '0', - }, - ModalFullscreenViewManager: {}, - AlertManager: { - alertWithArgs: jest.fn(), - }, - Clipboard: { - setString: jest.fn(), - }, - FbRelayNativeAdapter: { - updateCLC: jest.fn(), - }, -}; - -module.exports = NativeModules; diff --git a/Libraries/Renderer/src/renderers/native/__mocks__/InitializeJavaScriptAppEngine.js b/Libraries/Renderer/src/renderers/native/__mocks__/InitializeJavaScriptAppEngine.js deleted file mode 100644 index bc540c10d..000000000 --- a/Libraries/Renderer/src/renderers/native/__mocks__/InitializeJavaScriptAppEngine.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -// Noop - -// TODO #10932517: Move all initialization callers back into react-native diff --git a/Libraries/Renderer/src/renderers/native/__mocks__/RCTEventEmitter.js b/Libraries/Renderer/src/renderers/native/__mocks__/RCTEventEmitter.js deleted file mode 100644 index d6e66ad50..000000000 --- a/Libraries/Renderer/src/renderers/native/__mocks__/RCTEventEmitter.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -var RCTEventEmitter = { - register: jest.fn(), -}; - -module.exports = RCTEventEmitter; diff --git a/Libraries/Renderer/src/renderers/native/__mocks__/TextInputState.js b/Libraries/Renderer/src/renderers/native/__mocks__/TextInputState.js deleted file mode 100644 index a0b4e576d..000000000 --- a/Libraries/Renderer/src/renderers/native/__mocks__/TextInputState.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -// Mock of the Native Hooks -// TODO: Should this move into the components themselves? E.g. focusable - -var TextInputState = {}; - -module.exports = TextInputState; diff --git a/Libraries/Renderer/src/renderers/native/__mocks__/UIManager.js b/Libraries/Renderer/src/renderers/native/__mocks__/UIManager.js deleted file mode 100644 index ddcba12ca..000000000 --- a/Libraries/Renderer/src/renderers/native/__mocks__/UIManager.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -// Mock of the Native Hooks - -var RCTUIManager = { - createView: jest.fn(), - setChildren: jest.fn(), - manageChildren: jest.fn(), - updateView: jest.fn(), - removeSubviewsFromContainerWithID: jest.fn(), - replaceExistingNonRootView: jest.fn(), -}; - -module.exports = RCTUIManager; diff --git a/Libraries/Renderer/src/renderers/native/__mocks__/View.js b/Libraries/Renderer/src/renderers/native/__mocks__/View.js deleted file mode 100644 index 71856da16..000000000 --- a/Libraries/Renderer/src/renderers/native/__mocks__/View.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -var createReactNativeComponentClass = require('createReactNativeComponentClass'); - -var View = createReactNativeComponentClass({ - validAttributes: {}, - uiViewClassName: 'View', -}); - -module.exports = View; diff --git a/Libraries/Renderer/src/renderers/native/__mocks__/deepDiffer.js b/Libraries/Renderer/src/renderers/native/__mocks__/deepDiffer.js deleted file mode 100644 index 34e4da74a..000000000 --- a/Libraries/Renderer/src/renderers/native/__mocks__/deepDiffer.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -// TODO: Move deepDiffer into react - -var deepDiffer = function(one: any, two: any): boolean { - if (one === two) { - // Short circuit on identical object references instead of traversing them. - return false; - } - if ((typeof one === 'function') && (typeof two === 'function')) { - // We consider all functions equal - return false; - } - if ((typeof one !== 'object') || (one === null)) { - // Primitives can be directly compared - return one !== two; - } - if ((typeof two !== 'object') || (two === null)) { - // We know they are different because the previous case would have triggered - // otherwise. - return true; - } - if (one.constructor !== two.constructor) { - return true; - } - if (Array.isArray(one)) { - // We know two is also an array because the constructors are equal - var len = one.length; - if (two.length !== len) { - return true; - } - for (var ii = 0; ii < len; ii++) { - if (deepDiffer(one[ii], two[ii])) { - return true; - } - } - } else { - for (var key in one) { - if (deepDiffer(one[key], two[key])) { - return true; - } - } - for (var twoKey in two) { - // The only case we haven't checked yet is keys that are in two but aren't - // in one, which means they are different. - if (one[twoKey] === undefined && two[twoKey] !== undefined) { - return true; - } - } - } - return false; -}; - -module.exports = deepDiffer; diff --git a/Libraries/Renderer/src/renderers/native/__mocks__/deepFreezeAndThrowOnMutationInDev.js b/Libraries/Renderer/src/renderers/native/__mocks__/deepFreezeAndThrowOnMutationInDev.js deleted file mode 100644 index ebb81c333..000000000 --- a/Libraries/Renderer/src/renderers/native/__mocks__/deepFreezeAndThrowOnMutationInDev.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -// TODO: move into react or fbjs - -var deepFreezeAndThrowOnMutationInDev = function() { }; - -module.exports = deepFreezeAndThrowOnMutationInDev; diff --git a/Libraries/Renderer/src/renderers/native/__mocks__/flattenStyle.js b/Libraries/Renderer/src/renderers/native/__mocks__/flattenStyle.js deleted file mode 100644 index a766c705f..000000000 --- a/Libraries/Renderer/src/renderers/native/__mocks__/flattenStyle.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -'use strict'; - -// TODO: Move flattenStyle into react - -var flattenStyle = function() { }; - -module.exports = flattenStyle;