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

Improve unit tests coverage for api code #287

Open
5 tasks
ZibanPirate opened this issue Apr 10, 2021 · 4 comments
Open
5 tasks

Improve unit tests coverage for api code #287

ZibanPirate opened this issue Apr 10, 2021 · 4 comments
Labels
good first issue Good for newcomers task Task

Comments

@ZibanPirate
Copy link
Member

Description

if you:

  • go to ./api folder
  • then run yarn test:cov:watch inside it
  • then open ./api/coverage/lcov-report/index.html file in your browser

you will see that some directories are marked as red, which means test coverage is below 80%. you can also see the same results in codecov.io

In this task we will make sure that all dirs are marked green ✅.

Check List

  1. add unit test for ./api/src/logger/service.ts, similar to config/service.spec.ts
  2. add unit test for ./api/src/app/middlewares/error.ts.
  3. add unit test for ./api/src/app/middlewares/logger.ts.
  4. add unit test for ./api/src/app/middlewares/security.ts.
  5. add unit test for ./api/src/app/middlewares/docs.ts.

after #286 is done, more tasks will be added here...

Additional Comments

Please create new PR for each task.

Also, it would be great for transparency if you comment below which task you want to take up.

@ZibanPirate ZibanPirate added good first issue Good for newcomers task Task labels Apr 10, 2021
@cherifGsoul
Copy link

cherifGsoul commented Apr 12, 2021

The logger is an wrapper around winston I guess it should be covered with contract test.

@ZibanPirate
Copy link
Member Author

ZibanPirate commented Apr 12, 2021

well @cherifGsoul , since in this case the provider is a npm package (winston) which follows the semantic versioning, its API will always stay the same, and in case where we upgrade to a major version, then Typescript will report errors if we have API incompatibility.

Now that you brought this up, i'm thinking the GithubService needs a contract test don't you think? as it's does REST calls to Github APIs, if so, then we can create new Task ticket about contract testing where we define where we place them, be it GithubService or any other place

@cherifGsoul
Copy link

Semantic versioning doesn't guarantee that the library API will remain the same forever, major version allows breaking changes.

I would split GithHub service in two classes, the service itself just uses collaborators like the module that ensures communication with GitHub web services, the latter is candidate for contract tests.

That's my two cents, best of luck.

@cherifGsoul
Copy link

and in case where we upgrade to a major version, then Typescript will report errors if we have API incompatibility.

The point of the wrapper is to be ready for the new API with minimum effort.

@ZibanPirate ZibanPirate moved this to Backlog in DzCode i/o Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers task Task
Projects
Status: Backlog
Development

No branches or pull requests

2 participants