-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Arbitrary set from array of constant values #127
Comments
Indeed the feature you suggest can be very useful and is not yet available out of the box. The current way to do that would be const toppings = [/*your data*/];
const topArb = fc.array(fc.boolean(), toppings.length, toppings.length)
.map(selection => toppings.filter((v, id) => selection[id] === true)); Or maybe something based on An implementation with min/max boundaries would require more work. In order to do that you can maybe use The filter would be something like: const boundTopArb = topArb.filter(ts => min <= ts.length && ts.length <= max); Sent from my mobile, I have not tried to run the code above but it should work fine if no typos :) |
For the naming I was thinking of something like: What do you think of those names? Any other suggestions? |
Both of those names look good to me! 👍 |
I just started to implement the Does it fit your needs? |
Yeah that looks great thanks! This can be closed now |
Great |
If I have:
I would like to create an
Arbitrary<string[]>
that will deliver values such as:(The min and max size should be customizeable)
(Ideally the order in the results should be the same as the order in the
pizzaToppings
array)I can use use
fc.set
but I believe this is not ideal because:Thank you
The text was updated successfully, but these errors were encountered: