feat(notifications): delete flows (PR 3/7)#514
Open
sarthak688 wants to merge 2 commits into
Open
Conversation
Adds the two delete methods. Both POST to the NotificationEntry.DeleteBulk OData action; deleteAll uses the server-side deleteAll flag. Preserves the API spec's misspelling `notifcationIds` in the request body — the server expects that exact (mistyped) key. Tests: 4 additional unit tests. No integration tests — these destructively mutate the inbox with no SDK-level undo. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
This was referenced Jun 12, 2026
Comment on lines
+207
to
+213
| it('should propagate errors', async () => { | ||
| mockApiClient.post.mockRejectedValue(createMockError(TEST_CONSTANTS.ERROR_MESSAGE)); | ||
|
|
||
| await expect( | ||
| notificationService.deleteNotifications(NOTIFICATION_TEST_CONSTANTS.TENANT_ID, [NOTIFICATION_TEST_CONSTANTS.NOTIFICATION_ID]) | ||
| ).rejects.toThrow(TEST_CONSTANTS.ERROR_MESSAGE); | ||
| }); |
Contributor
There was a problem hiding this comment.
Per the testing conventions, entity-specific methods (those that operate on specific IDs) should use domain-specific error constants, not the generic TEST_CONSTANTS.ERROR_MESSAGE. Compare with the markRead error test (line 129) which correctly uses NOTIFICATION_TEST_CONSTANTS.ERROR_NOTIFICATION_NOT_FOUND.
Suggested change
| it('should propagate errors', async () => { | |
| mockApiClient.post.mockRejectedValue(createMockError(TEST_CONSTANTS.ERROR_MESSAGE)); | |
| await expect( | |
| notificationService.deleteNotifications(NOTIFICATION_TEST_CONSTANTS.TENANT_ID, [NOTIFICATION_TEST_CONSTANTS.NOTIFICATION_ID]) | |
| ).rejects.toThrow(TEST_CONSTANTS.ERROR_MESSAGE); | |
| }); | |
| it('should propagate errors', async () => { | |
| mockApiClient.post.mockRejectedValue(createMockError(NOTIFICATION_TEST_CONSTANTS.ERROR_NOTIFICATION_NOT_FOUND)); | |
| await expect( | |
| notificationService.deleteNotifications(NOTIFICATION_TEST_CONSTANTS.TENANT_ID, [NOTIFICATION_TEST_CONSTANTS.NOTIFICATION_ID]) | |
| ).rejects.toThrow(NOTIFICATION_TEST_CONSTANTS.ERROR_NOTIFICATION_NOT_FOUND); | |
| }); |
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.
PR 3/7 in the Notification SDK stack. Stacked on top of #513.
Adds the two delete methods. Both POST to the same
DeleteBulkOData action endpoint;deleteAlluses the server-sidedeleteAllflag.Methods Added
notifications.deleteNotifications()deleteNotifications(tenantId: string, notificationIds: string[]): Promise<NotificationDeleteResponse>notifications.deleteAll()deleteAll(tenantId: string): Promise<NotificationDeleteAllResponse>Endpoint Called
deleteNotifications()/deleteAll()notificationservice_/notificationserviceapi/odata/v1/NotificationEntry/UiPath.NotificationService.Api.DeleteBulkNotificationServicenotifcationIds(sic), notnotificationIds. The SDK preserves the typo to match the live API; the SDK's public surface uses the correct spelling.deleteNotificationsrejects empty arrays at the server with HTTP 400 — documented in JSDoc; the SDK doesn't add a client-side guard to avoid drift if the server relaxes that constraint.deleteAllsends{ notifcationIds: [], deleteAll: true }— the server deletes everything for the acting user regardless.Example Usage
API Response vs SDK Response
deleteNotifications{ success: true, data: { notificationIds } }deleteAll{ success: true, data: { all: true } }Verification
npm run typechecknpm run lintnpm run test:unitNo integration tests for the delete methods — they destructively mutate the inbox with no SDK-level undo and would be hostile to repeat-run CI. Covered by unit tests for SDK shape and by manual smoke tests for live behaviour.
Files
src/utils/constants/endpoints/notification.ts(DELETE_BULK)src/models/notification/notifications.models.ts(response types + ServiceModel methods)src/services/notification/notifications.tstests/unit/services/notification/notifications.test.ts(+4 tests)tests/integration/shared/notification/notifications.integration.test.ts(note added explaining why no tests)docs/oauth-scopes.mdPR Stack
feat/notifications-sdkfeat/notifications-mark-readfeat/notifications-delete(this PR)feat/subscriptions-sdkfeat/subscriptions-topic-updatesfeat/subscriptions-publisher-updatesfeat/subscriptions-mode-reset🤖 Generated with Claude Code