Skip to content

Instantly share code, notes, and snippets.

@raekul
Created October 10, 2019 07:15
Show Gist options
  • Save raekul/273e4aa1140c6eb218a9eb93f269ee12 to your computer and use it in GitHub Desktop.
Save raekul/273e4aa1140c6eb218a9eb93f269ee12 to your computer and use it in GitHub Desktop.
// setup props function
export function setup<Props>(props: Props) {
return (testProps: Props | {} = {}): Props => ({
...props,
...testProps
});
}
// usage
const partialProps = setup<Props>({
children: 'Submit'
});
// in test
const props = partialProps({ clickHandler: fakeClickHandler });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment