Skip to content

Inconsistent Id between render #413

Closed
@KevinYobeth

Description

@KevinYobeth

Describe the bug
I'm using a snapshot test from jest which snapshot the DOM and checks for the diff on every test. The problem is the id on react-checkbox-tree is always changing. Hence I can't get the constant snapshot.

Reproduction steps

  1. Build a snapshot testing using jest.
  2. Run the test
  3. Run the test again, the snapshot result should be different

Expected behavior
Provide a way to not randomize the id, for example on MUI, we could add this snippet to lock the id randomization process

global.Math.random = jest.fn().mockImplementation(() => 1);

Screenshots
image 37

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions