Home / File/ ReactIs-test.js — react Source File

ReactIs-test.js — react Source File

Architecture documentation for ReactIs-test.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @emails react-core
 */

'use strict';

let React;
let ReactDOM;
let ReactIs;
let SuspenseList;

describe('ReactIs', () => {
  beforeEach(() => {
    jest.resetModules();

    React = require('react');
    ReactDOM = require('react-dom');
    ReactIs = require('react-is');

    if (gate(flags => flags.enableSuspenseList)) {
      SuspenseList = React.unstable_SuspenseList;
    }
  });

  it('should return undefined for unknown/invalid types', () => {
    expect(ReactIs.typeOf('abc')).toBe(undefined);
    expect(ReactIs.typeOf(true)).toBe(undefined);
    expect(ReactIs.typeOf(123)).toBe(undefined);
    expect(ReactIs.typeOf({})).toBe(undefined);
    expect(ReactIs.typeOf(null)).toBe(undefined);
    expect(ReactIs.typeOf(undefined)).toBe(undefined);
    expect(ReactIs.typeOf(NaN)).toBe(undefined);
    expect(ReactIs.typeOf(Symbol('def'))).toBe(undefined);
  });

  it('identifies valid element types', () => {
    class Component extends React.Component {
      render() {
        return React.createElement('div');
      }
    }
    class PureComponent extends React.PureComponent {
      render() {
        return React.createElement('div');
      }
    }

    const FunctionComponent = () => React.createElement('div');
    const ForwardRefComponent = React.forwardRef((props, ref) =>
      React.createElement(Component, {forwardedRef: ref, ...props}),
    );
    const LazyComponent = React.lazy(() => Component);
    const MemoComponent = React.memo(Component);
    const Context = React.createContext(false);

// ... (144 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactIs-test.js do?
ReactIs-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is ReactIs-test.js in the architecture?
ReactIs-test.js is located at packages/react-is/src/__tests__/ReactIs-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-is/src/__tests__).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free