You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing tests we'll often write a positive test i.e. something appears when we expect it to with a corresponding negative test i.e. it doesn't appear when it shouldn't.
For various reasons we want to keep things DRY (e.g. if the text changes, we don't want false-negatives in the negative test).
At the moment, the best we can come up with is
constwarningMatcher: [ByRoleMatcher,ByRoleOptions]=[(content,element)=>content==="status"&&element?.textContent?.includes("The file has warning(s) that may affect how your data will import"),{}];
Then
// Positive case i.e. we're looking for the warningexpect(screen.getByRole(...warningMatcher)).toBeInTheDocument();// Negative case i.e. we're asserting the warning does not appearexpect(screen.queryByRole(...warningMatcher)).not.toBeInTheDocument();
Wondering if API changes could make this (surely common?) use-case easier.
The text was updated successfully, but these errors were encountered:
Describe the feature you'd like:
When writing tests we'll often write a positive test i.e. something appears when we expect it to with a corresponding negative test i.e. it doesn't appear when it shouldn't.
For various reasons we want to keep things DRY (e.g. if the text changes, we don't want false-negatives in the negative test).
At the moment, the best we can come up with is
Then
Wondering if API changes could make this (surely common?) use-case easier.
The text was updated successfully, but these errors were encountered: