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

NoMongo: Incorrect Unit testing in src/test/graphql/types/Venue/creator.test.ts #3334

Closed
Piyushk8 opened this issue Mar 3, 2025 · 0 comments
Labels
bug Something isn't working test Testing application unapproved Unapproved for Pull Request

Comments

@Piyushk8
Copy link

Piyushk8 commented Mar 3, 2025

Bug Description

  • Unit tests fail to properly cover the logic of actual GraphQL resolvers in the specified file.
  • The tests utilize a _resolverContext_ instead of the correct GraphqlContext defined in context.ts for mockContextType .

Steps to Reproduce

  1. Navigate to the designated test file.
  2. Execute the unit tests, observing that all tests pass.
  3. Notice the lack of effective code coverage in the original resolver file.
  4. Try making any changes in original resolver ,tests still passes due to obvious reasons.

Expected Behavior

  • Unit tests should directly test the logic of the actual GraphQL resolvers, ensuring comprehensive code coverage instead of making a dummy resolver and testing that.
  • Any deviations from the original resolver logic should trigger test failures.
  • The GraphqlContext type, as specified in context.ts, should be consistently used for resolver contexts in tests, not a mock or simplified version.

Actual Behavior

  • The test file replicates resolver logic instead of directly testing the original resolvers, resulting in ineffective coverage.
  • The resolver context type used in tests (_testContext_) does not match the GraphqlContext used in the application.
  • Changes made to the original resolver logic do not cause the tests to fail, indicating a lack of proper testing.

Screenshots

Image 1: Demonstration of tests passing despite harmful changes to the actual resolver.

Image

Image 2: Screenshot showing test passing.
Image

Image3 : No coverage
Image

Potential internship candidates

Please read this if you are planning to apply for a Palisadoes Foundation internship

@Piyushk8 Piyushk8 added the bug Something isn't working label Mar 3, 2025
@github-actions github-actions bot added test Testing application unapproved Unapproved for Pull Request labels Mar 3, 2025
@Piyushk8 Piyushk8 closed this as completed Mar 3, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in NoMongo: Talawa-API Mar 3, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Talawa-API (Tests) Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test Testing application unapproved Unapproved for Pull Request
Projects
Status: Done
Status: Done
Development

No branches or pull requests

1 participant