Skip to content

Conversation

Zechiax
Copy link
Owner

@Zechiax Zechiax commented Aug 6, 2025

Differentiate between unauthenticated/authenticated tests, allow running of unauthenticated tests on pull requests

@Zechiax Zechiax requested a review from Copilot August 6, 2025 20:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the test structure to differentiate between authenticated and unauthenticated tests, enabling unauthenticated tests to run in pull requests while maintaining full test coverage in main branch builds.

Key changes:

  • Split test base classes into UnauthenticatedTestBase and AuthenticatedTestBase
  • Consolidated test data into a centralized TestData class
  • Updated CI/CD configuration to run only unauthenticated tests on pull requests

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/Modrinth.Net.Test/appsettings.json Removed configuration file in favor of user secrets
test/Modrinth.Net.Test/ModrinthApiTests/EndpointTests.cs Split into separate base classes for authenticated/unauthenticated tests
test/Modrinth.Net.Test/Modrinth.Net.Test.csproj Added user secrets support and updated dependencies
.github/workflows/dotnet.yml Updated CI to run different test sets based on context
README.md Added testing documentation
Multiple test files Updated to inherit from appropriate base classes and use centralized test data
Comments suppressed due to low confidence (1)

test/Modrinth.Net.Test/ModrinthApiTests/UserEndpointTests.cs:45

  • [nitpick] The test method name suggests it should work with any valid ID, but the implementation uses the current user's ID from an authenticated context. Consider renaming to GetCurrentUserAsync_WithUnauthenticatedClient_ShouldReturnUser or similar to better reflect the test's purpose.
    public async Task GetUserAsync_WithValidId_ShouldReturnUser()

@Zechiax Zechiax merged commit 8b168b7 into main Aug 6, 2025
3 checks passed
@Zechiax Zechiax deleted the feature/test-rework branch August 6, 2025 20:57
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