Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tests for GitHub Service (Jest) #76

Open
omjogani opened this issue Sep 3, 2024 · 5 comments
Open

Add Tests for GitHub Service (Jest) #76

omjogani opened this issue Sep 3, 2024 · 5 comments
Labels
test Its for adding a test to a feature

Comments

@omjogani
Copy link
Contributor

omjogani commented Sep 3, 2024

Description

We have a GitHub service, responsible for fetching all good first issues from GitHub, We want to have clean test suits. The testing environment is already configured in the project along with the test file (/__test__/services/github.test.ts).

Usage

to run all the tests run the following command

npm run test

Acceptance Criteria

  1. Mock third-party request calls and return static responses for testing
  2. Add appropriate test name to maintain code readability
  3. Test all functions in the service and refactor the tests frequently whenever required
  4. Consider Edge Cases to cover in the tests
  5. Don't add too many except in single test, rather breakdown those into multiple tests

Engineering Notes

We're using jest for testing and jest-mock-extended for mocking and other pre-made functions.

Feel free to pick this issue and comment down below in case of any questions/feedback!

@dotslashbit
Copy link
Contributor

@omjogani Should we break this in multiple tests per filter?

@dotslashbit dotslashbit added the test Its for adding a test to a feature label Sep 3, 2024
@omjogani
Copy link
Contributor Author

omjogani commented Sep 3, 2024

@omjogani Should we break this in multiple tests per filter?

Breaking testes into multiple files: Bad Idea while everything resides in github.ts, If we breakdown github.ts file then yes we should breakdown tests too in multiple files.

Breaking functionality into multiple test (filter wise or what so ever): Yes we should do that

@dotslashbit
Copy link
Contributor

@omjogani I think we should break it and then break the tests too, let me know your thoughts?

@omjogani
Copy link
Contributor Author

omjogani commented Sep 3, 2024

@omjogani I think we should break it and then break the tests too, let me know your thoughts?

Well, that's better, I will work on refactoring that by end of this week!

@dotslashbit
Copy link
Contributor

@omjogani Sure, take your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Its for adding a test to a feature
Projects
None yet
Development

No branches or pull requests

2 participants