Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Basic unit tests for components #60

Open
bfirsh opened this issue May 30, 2018 · 2 comments
Open

Basic unit tests for components #60

bfirsh opened this issue May 30, 2018 · 2 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed type/chore Things that don't change the app from a user's point of view, but need to be done

Comments

@bfirsh
Copy link
Contributor

bfirsh commented May 30, 2018

Each component should have a basic unit test that checks it renders and does roughly what it claims to do. They don't need to be in-depth. In fact, tests that are too in-depth will probably slow us down while the product is still young.

Container components which interact with Firebase are much harder to test, so I would suggest avoiding these for now. firebase-mock helps with this, but unfortunately it doesn't support almost all the queries we do. See #71.

If you want to work on this, comment with the component you are working on so you don't collide with somebody else!

@bfirsh bfirsh added help wanted Extra attention is needed good first issue Good for newcomers type/chore Things that don't change the app from a user's point of view, but need to be done labels May 30, 2018
@meetall
Copy link
Contributor

meetall commented Jun 5, 2018

Hello, when I try to run the tests, it seems all of them are skipped except one. Is this done on purpose?

@bfirsh
Copy link
Contributor Author

bfirsh commented Jun 6, 2018

@meetall Yes - so far! You can enable the Firestore rules by adding an admin key, but that is not documented. The others are skipped because we were rushing to get stuff finished last week.

Today I’ll clean and document some of this. When that’s done, I’ll let you know, and it’ll be ready for adding more tests. :)

bfirsh added a commit to bfirsh/boxwise that referenced this issue Jun 6, 2018
bfirsh added a commit to bfirsh/boxwise that referenced this issue Jun 6, 2018
bfirsh added a commit to bfirsh/boxwise that referenced this issue Jun 6, 2018
@bfirsh bfirsh self-assigned this Jun 7, 2018
barto74 pushed a commit that referenced this issue Jun 7, 2018
bfirsh pushed a commit that referenced this issue Jul 2, 2018
- Import change - the component name is not the default export, thus the brackets import will fail
- Moved the setup out of it into before block
- passed userSignIn method to component
- Changed the order in which we do expect to simplify the test - doesnt need to be async as everything is mocked
- fixed jest argument matching to match returned value
- un-skipped the test case

Part of #60
bfirsh pushed a commit that referenced this issue Jul 10, 2018
Implements part of #60

* Fixed component unit test for SignInForm

- Import change - the component name is not the default export, thus the brackets import will fail
- Moved the setup out of it into before block
- passed userSignIn method to component
- Changed the order in which we do expect to simplify the test - doesnt need to be async as everything is mocked
- fixed jest argument matching to match returned value
- un-skipped the test case

* removed unnecessary firebase prop

* Fixed component unit test for SignUpForm

- updated props sent to component
- removed the asyncronous expect - easier test structure
- un-skipped test

* Added a component unit test for ResetPassword

- Test that the resetPassword method is called when the form is submitted, granted an email is provided

* Add test cases to signIn/signUp components

- extracted duplicate code to update component into a test-util
- added test cases for incomplete form submission (user does not provide email / password etc)

* Refactor: update reset password test to use util
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers help wanted Extra attention is needed type/chore Things that don't change the app from a user's point of view, but need to be done
Projects
None yet
Development

No branches or pull requests

3 participants