react-native-macos/Libraries/Core/__mocks__/ErrorUtils.js

32 строки
856 B
JavaScript
Исходник Обычный вид История

/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
2015-04-24 23:14:24 +03:00
// This mock only provides short-circuited methods of applyWithGuard and guard.
// A lot of modules rely on these two functions. This mock relieves their tests
// from depending on the real ErrorUtils module. If you need real error handling
// don't use this mock.
'use strict';
function execute(fun, context, args) {
return fun.apply(context, args);
}
2015-04-24 23:14:24 +03:00
function reportError(error) {
throw error;
}
var ErrorUtils = {
apply: jest.fn(execute),
applyWithGuard: jest.fn(execute),
guard: jest.fn(callback => callback),
inGuard: jest.fn().mockReturnValue(true),
reportError: jest.fn(reportError),
setGlobalHandler: jest.fn(),
2015-04-24 23:14:24 +03:00
};
module.exports = ErrorUtils;