Skip to content

Commit

Permalink
Add requirement for component tests (#18015)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkjr authored Nov 29, 2023
1 parent 6b72126 commit bfa23c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/new-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ src

- `src/js`: Raw Javascript files, e.g. React Native Reanimated worklets.
- `src/mocks`: Plumbing configuration to be able to run tests.
- `src/quo/`: The component library for Status Mobile.
- `src/quo/`: The component library for Status Mobile. [Read more...](../src/quo/README.md)
- `src/react_native/`: Contains only low-level constructs to help React Native
work in tandem with Clojure(Script).
- `src/status_im2/`: Directory where we try to be as strict as possible about
Expand Down
11 changes: 11 additions & 0 deletions src/quo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ rendered. We use [React Native Testing Library](https://callstack.github.io/reac
There are dozens of examples in the repository, so use them as a reference. A
good and complete example is [quo.components.avatars.user-avatar.component-spec](/src/quo/components/avatars/user_avatar/component_spec.cljs)

### No-props test

When writing tests for the component that has props, please add one test that covers situation when props aren't passed. Because even if component not showing anything meaningful without props, it shouldn't crash.

```clojure
(h/describe "Transaction Progress"
(h/test "component renders without props"
(h/render [quo/transaction-progress {}])
(h/is-truthy (h/get-by-label-text :transaction-progress)))
```

## Do not couple the library with re-frame

Don't use re-frame inside this library (e.g. dispatch & subscribe). If a
Expand Down

0 comments on commit bfa23c1

Please sign in to comment.