Skip to content

Instantly share code, notes, and snippets.

@dmmulroy
Created April 5, 2024 19:29
Show Gist options
  • Save dmmulroy/df49e257831084e6c6ae351de08bb1dd to your computer and use it in GitHub Desktop.
Save dmmulroy/df49e257831084e6c6ae351de08bb1dd to your computer and use it in GitHub Desktop.
export function mockFromArbitrary<T>(arbitrary: Arbitrary<T>): T {
return fc.sample(arbitrary, 1)[0];
}
export function mockArrayFromArbitrary<T>(
arbitrary: Arbitrary<T>,
count?: number,
): T[] {
return fc.sample(arbitrary, count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment