Created
March 29, 2019 17:33
-
-
Save coryhouse/5103e68609ce251578ecc4adf20a0558 to your computer and use it in GitHub Desktop.
Custom render wrapper for each component with getters for each input for react-testing-library
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
import { render as r } from '../test-utils' | |
function render(ui, options) { | |
const utils = r(ui, options) | |
return { | |
...utils, | |
username: utils.getByLabelText(/username/i), | |
password: utils.getByLabelText(/password/i), | |
login: utils.getByText(/login/i), | |
successModal: () => utils.getByTestId('login-success') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A test using the func above: