Home / File/ normalizeConsoleFormat-test.internal.js — react Source File

normalizeConsoleFormat-test.internal.js — react Source File

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

Entity Profile

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 normalizeConsoleFormat;

describe('normalizeConsoleFormat', () => {
  beforeEach(() => {
    normalizeConsoleFormat = require('shared/normalizeConsoleFormat').default;
  });

  it('normalize empty string', async () => {
    expect(normalizeConsoleFormat('', [1, {}, 'foo'], 0)).toMatchInlineSnapshot(
      `"%o %o %s"`,
    );
  });

  it('normalize extra args', async () => {
    expect(
      normalizeConsoleFormat('%f', [1, {}, 'foo'], 0),
    ).toMatchInlineSnapshot(`"%f %o %s"`);
  });

  it('normalize fewer than args', async () => {
    expect(
      normalizeConsoleFormat('%s %O %o %f', [1, {}, 'foo'], 0),
    ).toMatchInlineSnapshot(`"%s %O %o %%f"`);
  });

  it('normalize escape sequences', async () => {
    expect(
      normalizeConsoleFormat('hel%lo %s %%s world', [1, 'foo'], 0),
    ).toMatchInlineSnapshot(`"hel%lo %s %%s world %s"`);
  });

  it('normalize ending with escape', async () => {
    expect(
      normalizeConsoleFormat('hello %s world %', [1, {}, 'foo'], 0),
    ).toMatchInlineSnapshot(`"hello %s world % %o %s"`);
    expect(
      normalizeConsoleFormat('hello %s world %', [], 0),
    ).toMatchInlineSnapshot(`"hello %%s world %"`);
  });
});

Frequently Asked Questions

What does normalizeConsoleFormat-test.internal.js do?
normalizeConsoleFormat-test.internal.js is a source file in the react codebase, written in javascript.
Where is normalizeConsoleFormat-test.internal.js in the architecture?
normalizeConsoleFormat-test.internal.js is located at packages/shared/__tests__/normalizeConsoleFormat-test.internal.js (directory: packages/shared/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free