main
js 35 lines 890 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @emails react-core
8 * @jest-environment node
9 */
10
11 'use strict';
12
13 let createReactNativeComponentClass;
14
15 describe('ReactNativeError', () => {
16 beforeEach(() => {
17 jest.resetModules();
18
19 createReactNativeComponentClass =
20 require('react-native/react-private-interface')
21 .ReactNativeViewConfigRegistry.register;
22 });
23
24 it('should throw error if null component registration getter is used', () => {
25 expect(() => {
26 try {
27 createReactNativeComponentClass('View', null);
28 } catch (e) {
29 throw new Error(e.toString());
30 }
31 }).toThrow(
32 'View config getter callback for component `View` must be a function (received `null`)',
33 );
34 });
35 });