Home / Function/ expectHookMapToEqual() — react Function Reference

expectHookMapToEqual() — react Function Reference

Architecture documentation for the expectHookMapToEqual() function in getHookNameForLocation-test.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  497cf0eb_9b3f_1fa2_27bf_5ef85c9a02de["expectHookMapToEqual()"]
  1ab77cff_6803_e7fc_0f93_59c0fdfeb26e["getHookNameForLocation-test.js"]
  497cf0eb_9b3f_1fa2_27bf_5ef85c9a02de -->|defined in| 1ab77cff_6803_e7fc_0f93_59c0fdfeb26e
  style 497cf0eb_9b3f_1fa2_27bf_5ef85c9a02de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/hooks/__tests__/getHookNameForLocation-test.js lines 14–28

function expectHookMapToEqual(actual, expected) {
  expect(actual.names).toEqual(expected.names);

  const formattedMappings = [];
  actual.mappings.forEach(lines => {
    lines.forEach(segment => {
      const name = actual.names[segment[2]];
      if (name == null) {
        throw new Error(`Expected to find name at position ${segment[2]}`);
      }
      formattedMappings.push(`${name} from ${segment[0]}:${segment[1]}`);
    });
  });
  expect(formattedMappings).toEqual(expected.mappings);
}

Domain

Subdomains

Frequently Asked Questions

What does expectHookMapToEqual() do?
expectHookMapToEqual() is a function in the react codebase, defined in packages/react-devtools-shared/src/hooks/__tests__/getHookNameForLocation-test.js.
Where is expectHookMapToEqual() defined?
expectHookMapToEqual() is defined in packages/react-devtools-shared/src/hooks/__tests__/getHookNameForLocation-test.js at line 14.

Analyze Your Own Codebase

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

Try Supermodel Free