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

ReactMarkupClient-test.js — react Source File

Architecture documentation for ReactMarkupClient-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 ReactMarkup;

function normalizeCodeLocInfo(str) {
  return (
    str &&
    String(str).replace(/\n +(?:at|in) ([\S]+)[^\n]*/g, function (m, name) {
      return '\n    in ' + name + ' (at **)';
    })
  );
}

if (!__EXPERIMENTAL__) {
  it('should not be built in stable', () => {
    try {
      require('react-markup');
    } catch (x) {
      return;
    }
    throw new Error('Expected react-markup not to exist in stable.');
  });
} else {
  describe('ReactMarkup', () => {
    beforeEach(() => {
      jest.resetModules();
      React = require('react');
      ReactMarkup = require('react-markup');
    });

    it('should be able to render a simple component', async () => {
      function Component() {
        return <div>hello world</div>;
      }

      const html = await ReactMarkup.experimental_renderToHTML(<Component />);
      expect(html).toBe('<div>hello world</div>');
    });

    it('should be able to render a large string', async () => {
      function Component() {
        return <div>{'hello '.repeat(200)}world</div>;
      }

      const html = await ReactMarkup.experimental_renderToHTML(
        React.createElement(Component),
      );
      expect(html).toBe('<div>' + ('hello '.repeat(200) + 'world') + '</div>');
    });

// ... (181 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactMarkupClient-test.js do?
ReactMarkupClient-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactMarkupClient-test.js?
ReactMarkupClient-test.js defines 1 function(s): normalizeCodeLocInfo.
Where is ReactMarkupClient-test.js in the architecture?
ReactMarkupClient-test.js is located at packages/react-markup/src/__tests__/ReactMarkupClient-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-markup/src/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free