Skip to content

Conversation

@devin-ai-integration
Copy link

@devin-ai-integration devin-ai-integration bot commented Dec 2, 2025

Add comprehensive GraphQL test suite

Summary

This PR adds a comprehensive test suite for GraphQL operations using Netflix DGS testing utilities. The tests cover all major GraphQL queries and mutations in the application.

Test files added (11 files, ~1850 lines):

  • ArticleDatafetcherTest - Article queries, pagination, filtering by author/tag/favorited
  • ArticleMutationTest - Article create, update, delete, favorite/unfavorite
  • CommentDatafetcherTest - Comment queries with cursor-based pagination
  • CommentMutationTest - Comment add/delete operations
  • MeDatafetcherTest - User query configuration (note: some tests skipped due to Authorization header requirement)
  • ProfileDatafetcherTest - Profile queries
  • RelationMutationTest - Follow/unfollow user operations
  • TagDatafetcherTest - Tag listing queries
  • UserMutationTest - User registration, login, update
  • GraphQLCustomizeExceptionHandlerTest - Exception handling for validation errors
  • TestSecurityConfig - Security configuration for test context

Testing approach:

  • Uses @SpringBootTest with DGS auto-configuration
  • Mocks all service dependencies with @MockBean
  • Sets up anonymous authentication in @BeforeEach to handle SecurityContext requirements

Review & Testing Checklist for Human

  • Verify the mocked service behaviors accurately reflect real service behavior (mocks may hide integration issues)
  • Review skipped MeDatafetcher tests - these require Authorization header which is difficult to provide in DGS test context
  • Check that atLeastOnce() verification is acceptable (used instead of strict verification due to DGS executor behavior)
  • Run ./gradlew test -x spotlessJava locally to confirm all 132 tests pass

Recommended test plan:

  1. Run the full test suite locally
  2. Spot-check a few test cases against the actual GraphQL schema to ensure queries are valid
  3. Consider if any critical paths are missing coverage

Notes

  • CI build failed due to pre-existing issue: deprecated actions/cache: v2 in GitHub Actions workflow (unrelated to this PR)
  • All tests pass locally (132 tests, 0 failures)

Requested by: Roshan Fernando (@rdf004)
Devin Session: https://app.devin.ai/sessions/e1c4f0c64b794fe3abab95d46bbf5838

This commit adds a comprehensive test suite for GraphQL operations including:

- ArticleDatafetcherTest: Tests for article queries, pagination, filtering
- ArticleMutationTest: Tests for article CRUD operations
- CommentDatafetcherTest: Tests for comment queries and pagination
- CommentMutationTest: Tests for comment add/delete operations
- MeDatafetcherTest: Test configuration for user queries
- ProfileDatafetcherTest: Tests for profile queries
- RelationMutationTest: Tests for follow/unfollow operations
- TagDatafetcherTest: Tests for tag queries
- UserMutationTest: Tests for user registration, login, and update
- GraphQLCustomizeExceptionHandlerTest: Tests for exception handling
- TestSecurityConfig: Security configuration for tests

The tests use Netflix DGS testing utilities with MockBean for service mocking.

Co-Authored-By: Roshan  Fernando <roshan.fernando@cognition.ai>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant