[PM-34546] Add integration tests for Notifications POST /send endpoint - #8171
Conversation
Adds PostSendEndpointTests and NotificationsApplicationFactory to test/Notifications.Test. The tests form a three-part contract: 1. NotificationsApiPushEngine.PushAsync produces a payload that matches a format in SupportedPayloads, catching wire-format changes at CI time. 2. Every format in SupportedPayloads is accepted by the live /send endpoint and routed to the correct SignalR hub group. 3. PushAsync calls with a specific ClientType in the notification payload route to the correct client-type-scoped group. SupportedPayloads also serves as the rolling-upgrade compatibility list: old formats are kept for at least one release so that senders on the previous version still work after Notifications is updated.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8171 +/- ##
==========================================
+ Coverage 63.38% 63.66% +0.28%
==========================================
Files 2337 2338 +1
Lines 101456 101524 +68
Branches 9167 9179 +12
==========================================
+ Hits 64303 64637 +334
+ Misses 34942 34672 -270
- Partials 2211 2215 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Test-only change adding integration coverage for Code Review DetailsNo findings at or above the reporting threshold. Minor, not worth an inline comment: Dependency Changes
Lock file ( |
- Capture actual wire bytes via ReadAsStringAsync instead of re-serializing with default JsonSerializerOptions (which produced PascalCase rather than the camelCase JsonContent.Create emits) - Update SupportedPayloads literals to camelCase to match the real wire format - Make RoutingCases the single source of truth; derive SupportedPayloads from it so the two arrays can never desynchronize
withinfocus
left a comment
There was a problem hiding this comment.
Works for me, but see the AI review comment for some suggestions that it didn't bubble up into dedicated suggestions.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-34546
📔 Objective
Adds integration tests for the
POST /sendendpoint on the Notifications service.The tests form a three-part contract:
PushAsync_ProducesASupportedPayload— the realNotificationsApiPushEnginemust produce a payload matching a format inSupportedPayloads, catching wire-format changes at CI time.PostSend_RoutesPayloadToCorrectHubGroup— every format inSupportedPayloadsis accepted by the live/sendendpoint and routed to the correct SignalR hub group.PushAsync_Notification_RoutesToClientTypeGroup— aPushAsynccall with a specificClientTypein the notification payload routes end-to-end to the correct client-type-scoped SignalR group.SupportedPayloadsalso serves as the rolling-upgrade compatibility list: old formats are kept for at least one release so that senders on the previous version still work after Notifications is deployed.