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

Create all API Resolver Tests #490

Closed
palisadoes opened this issue Feb 24, 2022 · 0 comments
Closed

Create all API Resolver Tests #490

palisadoes opened this issue Feb 24, 2022 · 0 comments
Assignees
Labels
bug Something isn't working parent Parent issue test Testing application wip Work in Progress

Comments

@palisadoes
Copy link
Contributor

palisadoes commented Feb 24, 2022

The Talawa-API code base needs to be 100% reliable. This means we need 100% test code coverage.

Our resolver test suite must cover all resolvers and function correctly.

This is a parent issue for resolver tests:

  • We'll only assign the child issues.
  • Please comment on one of the child issues for assignment.
  • Only one child issue will be assigned to a person at any one time.

API Resolver File Template

The API resolver file will need to be refactored using these guidelines

API Function

This is the part of the file's code that accesses backend systems such as object storage and data storage. We require this code to have dedicated functions.

The function must:

  • Perform a single resolver task based on user input parameters

  • Perform a database or object storage call

  • Delegate calculation, sorting, data structuring or usage of external packages to a separate non-API function in the same file.

  • Response creator function if a particular unit task needs to be performed for some sort of structuring

  • Return a response

  • Note: You must ensure that if the API fails in any of the function's steps that all the previously executed database calls in the function are reversed.

Unit Function

This is the part of the file's code that does not access backend systems at all. We require this code to have dedicated functions.

The function must:

  • Perform a single task
  • Receive input as needed (ie. input provided by users)
  • Perform the required calculation, sorting, data structuring or usage of external packages for the function's task
  • Return the desired output, which is to be utilised in API Function

Other

It is possible that you may need to combine unit functions and database calls together to get the desired functionality. This is OK, however for make sure these functions mostly contain only unit functions. These combined functions must be tested also.

API Resolver Test File Template

Utilise the unit function to your test code to get the results and check the response.

Child Issues:

@palisadoes palisadoes added the bug Something isn't working label Feb 24, 2022
@palisadoes palisadoes self-assigned this Feb 24, 2022
@palisadoes palisadoes added the wip Work in Progress label Feb 24, 2022
@github-actions github-actions bot added parent Parent issue test Testing application unapproved Unapproved for Pull Request labels Feb 24, 2022
@github-project-automation github-project-automation bot moved this from Backlog to Done in Talawa-API (Tests) Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parent Parent issue test Testing application wip Work in Progress
Projects
Archived in project
Development

No branches or pull requests

1 participant