Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bheftel opened this issue Jan 14, 2025 · 1 comment

Comments

@bheftel
Copy link

bheftel commented Jan 14, 2025

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.

@rokotyan
Copy link
Contributor

Thanks for the feedback @bheftel, we're open to contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants