-
Story
-
Resolution: Unresolved
-
Normal
-
None
-
1
-
False
-
False
-
0
-
undefined
-
Not Supported
-
-
-
ODC Sprint 217, ODC Sprint 218, ODC Sprint 227, ODC Sprint 228, ODC Sprint 229, ODC Sprint 230
Description of problem:
With ODC-5851 we introduced react-testing-library (or the "testing-library") to our code.
Most react examples also uses the "jest-dom" extensions (https://testing-library.com/docs/ecosystem-jest-dom/) which provides additional semantic assertions like
expect(...).toBeEnabled() expect(...).toBeDisabled() expect(...).toHaveValue(...) expect(...).toHaveDescription(...) expect(...).toBeChecked()
This makes our tese case easier to understand then... for example:
expect(element.getAttribute("disabled")).toEquals("disabled") expect((element as HTMLInputElement).value)).toEquals(...)
To simplify our tests and make adopting the examples from the official website easier, we should also add the "jest-dom" extension.
:warning: The problem with just adding the library is that the typescript definition breaks jest autocompletion / type definition. For example:
expect("").to<tab> // doesn't show toEquals or toBeEnabled after installing the library!
Actual results:
- react-testing-library jest-dom extension is not available
Expected results:
- react-testing-library jest-dom should be available and tested with some of our react-testing-library tests (or a new one)
- Autocompletion / Type definition of expect() should still work !!
Additional notes
- is blocked by
-
ODC-6775 Upgrade jest from 21 to 27
- To Do