Skip to content

Commit

Permalink
docs/howto/testing: Add/tweak for platform-specific testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe committed Apr 27, 2021
1 parent 1348f6f commit 4cb5033
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion docs/howto/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ To write a test, place a Javascript file with the `-test.js` suffix in the
`__tests__` directory inside of any subfolder of `/src`. The test will be
automatically picked up by the test runner.

We've configured Jest to run two different
["projects"](https://jestjs.io/docs/configuration#projects-arraystring--projectconfig):
one with an iOS preset, and one with an Android preset.
`tools/test jest` will run one or the other, or both, depending on
what you pass for `--platform`.

If it makes sense for a test file to be dedicated to just one
platform, and that's unlikely to change, you can instead suffix it
with `-test.ios.js` or `-test.android.js`, and it will be ignored when
the other platform's project runs.

### Test style guide

Expand Down Expand Up @@ -52,7 +62,9 @@ automatically picked up by the test runner.
be mutated and hence will eventually fail tests in case of mutation.


## Unit tests: Android
## Native-code tests:

### Android

We have a small, nascent suite of unit tests for our Android-native
(Kotlin and Java) code.
Expand Down Expand Up @@ -88,6 +100,12 @@ Other sources which might be helpful to read or refer to:
[baeldung-junit-kotlin]: https://www.baeldung.com/junit-5-kotlin
[baeldung-truth]: https://www.baeldung.com/google-truth

### iOS

We don't yet have native-code tests for iOS. We should try it out! A
good incremental step will be to at least check that the build
completes without errors.


## Functional tests

Expand Down
2 changes: 1 addition & 1 deletion tools/test
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ run_native() {
else
:
# TODO: uncomment when we actually have iOS native tests, like
# making a build.
# making a build. Also update docs/howto/testing.md.
# echo -e $'\e[31mSkipping native iOS tests. Use --platform to control this.\e[0m';
fi
}
Expand Down

0 comments on commit 4cb5033

Please sign in to comment.