framework
framework copied to clipboard
Frontend tests
While tests are very helpful, too many tests, or too intensive tests make the code hard and more cumbersome to change. So what we need are rather basic tests for components, and when appropriate (like extenders or utils/helpers) more in-depth tests.
Striking a balance between sufficient test coverage and maintainability is crucial here.
The most basic test we can have for a component, yet can still be useful, is that it simply renders without issues and some interactions (such as any clicks) work as expected.
We'll prioritize components that are building blocks of other components. Then Utils/Helpers that are most commonly used. Then Extenders. And finally Large components. (integration tests if possible)
Building Blocks
- Avatar
- Badge
- Button
- Checkbox
- ColorPreviewInput
- Dropdown
- FieldSet
- Modal & FormModal
- Input
- Icon
- Link & LinkButton
- LoadingIndicator
- MultiSelect
- Select
- SelectDropdown
- SplitDropdown
- ~~Tooltip~~ (tied to jquery so skipping for now)
Utils/Helpers
- highlight
- string
- extractText
- listItems
- extend & override
Extenders
- Model
- PostTypes
- Notification
- Routes
- Search
- Store
Larger components
- PostStream
- AlertManager
- ModalManager
- The various modals (asserting that they render without issue would already be good to have)
- Somepages like the
IndexPage
if possible
Relevant links, should be documented with the docs we will add for frontend testing:
- https://mithril.js.org/testing.html
- https://jestjs.io/docs/using-matchers
Must also add the Jest
infra generation to the CLI.