Created
October 10, 2019 07:15
-
-
Save raekul/273e4aa1140c6eb218a9eb93f269ee12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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