talawa-api icon indicating copy to clipboard operation
talawa-api copied to clipboard

Resolvers: Create tests for updateUserProfile.js

Open palisadoes opened this issue 3 years ago • 8 comments

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

Tests need to be written for file lib/resolvers/user_mutations/updateUserProfile.js

  • We will need the API to be refactored for all methods, classes and/or functions found in this file for testing to be correctly executed.
  • When complete, all all methods, classes and/or functions in the refactored file will need to be tested. These tests must be placed in a single file with the name tests/resolvers/user_mutations/updateUserProfile.spec.js. You may need to create the appropriate directory structure to do this.

IMPORTANT:

Please refer to the parent issue on how to implement these tests correctly:

  • https://github.com/PalisadoesFoundation/talawa-api/issues/490

PR Acceptance Criteria

  • When complete this file must show 100% coverage when merged into the code base. This will be clearly visible when you submit your PR.
  • The current code coverage for the file can be found here. If the file isn't found in this directory, or there is a 404 error, then tests have not been created.
  • The PR will show a report for the code coverage for the file you have added. You can use that as a guide.

palisadoes avatar Feb 24 '22 17:02 palisadoes

@palisadoes I want to know if this issue is still available, because It seems that most of the test cases have already been written but they are still open as an issue.

Freedisch avatar Nov 26 '22 12:11 Freedisch

We have done many of the tests. Please let me know if any you find that should be closed.

Otherwise feel free to go ahead and work on any that are still valid.

palisadoes avatar Nov 26 '22 18:11 palisadoes

@palisadoes I checked, and there is already a test file for this issue. I tried to run a test coverage, but i just keep getting these result image

image

Freedisch avatar Nov 27 '22 12:11 Freedisch

@Freedisch the updateUserProfile.js is having around 30% Code Coverage but expected coverage is 100% image

SiddheshKukade avatar Dec 03 '22 10:12 SiddheshKukade

@SiddheshKukade, please, how did you run the test coverage, I'm running it on my machine, and I'm not getting any result I run npm run test and I'm getting no result. Did I miss a step?

Freedisch avatar Dec 03 '22 10:12 Freedisch

@Freedisch it's simple use yarn test --coverage

SiddheshKukade avatar Dec 03 '22 10:12 SiddheshKukade

@SiddheshKukade I keep getting the same error whether with npm run test or yarn test --coverage · __tests__/resolvers/Query/postsByOrganizationConnection.spec.ts (1) · __tests__/resolvers/Query/organizationsMemberConnection.spec.ts (1) · __tests__/resolvers/Query/postsByOrganization.spec.ts (18) · __tests__/resolvers/Query/posts.spec.ts (18)

Freedisch avatar Dec 03 '22 11:12 Freedisch

It's okay I just fixed it, the bug was from my MongoDB setup. I'm working on the issue

Freedisch avatar Dec 03 '22 12:12 Freedisch

@Freedisch are you still working on this?

palisadoes avatar Jan 23 '23 23:01 palisadoes

If @Freedisch is unavailable pls assign it to me.

kb-0311 avatar Jan 25 '23 19:01 kb-0311

100% code coverage has been reached

palisadoes avatar Jan 27 '23 18:01 palisadoes