plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

How to mock randstr for snapshots

Open bozdoz opened this issue 1 year ago • 1 comments

Wondering how I can use jest snapshots while plotly is using its own randstr function (i.e. there's nothing to mock out)

bozdoz avatar Sep 06 '22 21:09 bozdoz

I don't know of a way, unless you've included plotly.js from source in which case you should be able to directly import plotly.js/src/lib and replace Lib.randstr with whatever you want. Anyway the function is defined here, we'd be happy to accept a PR to make it easily mockable.

alexcjohnson avatar Sep 06 '22 23:09 alexcjohnson