Refactor test endpoints to message-based API#187
Open
skwig wants to merge 9 commits into
Open
Conversation
- Add HandleMessageCreatedAsync_IgnoresBotMessages test that verifies bot messages are filtered - Add HandleMessageCreatedAsync_DelegatesToMessageProcessor test (currently skipped due to DSharpPlus mocking limitations) - Replace constructor-only tests with behavioral tests using reflection-based mocking - Note: Full delegation test blocked by DSharpPlus EventArgs custom property getters that cannot be mocked via reflection
- Migrate all 5 E2E scenario files to use POST /test/message instead of command-specific endpoints - Convert /test/image-message requests to /test/message with attachments array - Convert /test/link-message requests to /test/message with embeds array - Convert /test/bot-command requests to /test/message with content and currentMemberId - Add mediaType inference from file extensions in PostMessageEndpoint to support legacy tests - Fix listener DI scoping: listeners are singletons that create scopes for MessageProcessor - Fix DependencyInjection.cs syntax (was using 'extension' instead of 'public static') All E2E tests now pass with the new unified endpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors test endpoints from command-specific endpoints (
/test/image-message,/test/link-message,/test/bot-command) to a unified message-based API (POST/PUT/DELETE /test/message). This decouples test infrastructure from DSharpPlus and centralizes business logic in a testableMessageProcessorabstraction.Changes
Architecture
/test/messageendpoint handles all message types (images, links, commands)New Components
IMessageProcessor/MessageProcessor- Core abstraction with ProcessCreatedMessageAsync/UpdatedMessageAsync/DeletedMessageAsyncMessageDatadomain models - Decouples from DSharpPlus EventArgsImprovements
Testing
dotnet formatCommits
Breaking Changes
None for production. Test endpoints changed but E2E tests updated accordingly.
Documentation
test/e2e/README.mdwith comprehensive endpoint documentationdocs/plans/2025-12-31-message-based-test-endpoints.md