Home / File/ update-expressions.e2e.js — react Source File

update-expressions.e2e.js — react Source File

Architecture documentation for update-expressions.e2e.js, a javascript file in the react codebase. 5 imports, 0 dependents.

File javascript TestingUtilities E2E 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  6a22fc9f_1a4b_6610_95d6_bfdc001cec83["update-expressions.e2e.js"]
  5a08878b_7e8d_9201_126f_b2be03bccb80["expectLogs.js"]
  6a22fc9f_1a4b_6610_95d6_bfdc001cec83 --> 5a08878b_7e8d_9201_126f_b2be03bccb80
  9b5c28a1_7004_c572_dd53_c78918c8eb26["expectLogsAndClear"]
  6a22fc9f_1a4b_6610_95d6_bfdc001cec83 --> 9b5c28a1_7004_c572_dd53_c78918c8eb26
  ce4848f8_46e9_ec40_9ee1_bb0abaf07e5b["log"]
  6a22fc9f_1a4b_6610_95d6_bfdc001cec83 --> ce4848f8_46e9_ec40_9ee1_bb0abaf07e5b
  9adf9051_2ce4_6a22_5a47_ad6ee61b1f13["react"]
  6a22fc9f_1a4b_6610_95d6_bfdc001cec83 --> 9adf9051_2ce4_6a22_5a47_ad6ee61b1f13
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  6a22fc9f_1a4b_6610_95d6_bfdc001cec83 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style 6a22fc9f_1a4b_6610_95d6_bfdc001cec83 fill:#6366f1,stroke:#818cf8,color:#fff

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.
 */

import {render, screen, fireEvent} from '@testing-library/react';
import * as React from 'react';
import {expectLogsAndClear, log} from './expectLogs';

function Counter(props) {
  'use memo';
  let value = props.value;
  let a = value++;
  expect(a).toBe(props.value); // postfix
  let b = ++value;
  expect(b).toBe(props.value + 2); // previous postfix operation + prefix operation
  let c = ++value;
  expect(c).toBe(props.value + 3);
  let d = value--;
  expect(d).toBe(props.value + 3);
  let e = --value;
  expect(e).toBe(props.value + 1);
  let f = --value;
  expect(f).toBe(props.value);
  expect(value).toBe(props.value);
  return <span>{value}</span>;
}

test('use-state', async () => {
  const {asFragment, rerender} = render(<Counter value={0} />);
  expect(asFragment()).toMatchInlineSnapshot(`
    <DocumentFragment>
      <span>
        0
      </span>
    </DocumentFragment>
  `);

  rerender(<Counter value={1} />);
  expect(asFragment()).toMatchInlineSnapshot(`
    <DocumentFragment>
      <span>
        1
      </span>
    </DocumentFragment>
  `);
});

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does update-expressions.e2e.js do?
update-expressions.e2e.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, E2E subdomain.
What functions are defined in update-expressions.e2e.js?
update-expressions.e2e.js defines 1 function(s): Counter.
What does update-expressions.e2e.js depend on?
update-expressions.e2e.js imports 5 module(s): expectLogs.js, expectLogsAndClear, log, react, react.
Where is update-expressions.e2e.js in the architecture?
update-expressions.e2e.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/e2e/update-expressions.e2e.js (domain: TestingUtilities, subdomain: E2E, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/e2e).

Analyze Your Own Codebase

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

Try Supermodel Free