Skip to content

Random guid in xy-container clippath causes inconsistencies for DOM snapshot tests #520

Open
@bheftel

Description

@bheftel

Seen in the StackedBar component, which gets a clippath id from XYComponentCore

https://github.com/f5/unovis/blob/main/packages/ts/src/containers/xy-container/index.ts#L51

I was adding DOM snapshot tests for a react page using StackedBar with react-testing-library snapshots and vitest, but a clippath id was different on every test run, so it would fail the snapshot comparison.

As a workaround you can mock crypto.getRandomValues that is used in the guid util function (https://github.com/f5/unovis/blob/main/packages/ts/src/utils/misc.ts#L6), but it would be good for snapshot testing to work out of the box and I don't know that these ids need to be random guids.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions