1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

PM-10564: Push notification updates to other clients

When a notification is updated, marked as read or deleted, a push notification is sent with updated push type event. The push notification includes the ReadDate and DeletedDate fields.
This commit is contained in:
Maciej Zieniuk
2024-11-21 21:39:28 +00:00
parent d028029270
commit d9711b6031
23 changed files with 663 additions and 155 deletions

View File

@ -14,17 +14,41 @@ namespace Bit.Core.Test.Services;
public class MultiServicePushNotificationServiceTests
{
[Theory]
[BitAutoData]
[BitAutoData(false)]
[BitAutoData(true)]
[NotificationCustomize]
public async Task PushSyncNotificationAsync_Notification_Sent(
SutProvider<MultiServicePushNotificationService> sutProvider, Notification notification)
[NotificationStatusCustomize]
public async Task PushSyncNotificationCreateAsync_Notification_Sent(bool notificationStatusNull,
SutProvider<MultiServicePushNotificationService> sutProvider, Notification notification,
NotificationStatus notificationStatus)
{
await sutProvider.Sut.PushSyncNotificationAsync(notification);
await sutProvider.Sut.PushSyncNotificationCreateAsync(notification,
notificationStatusNull ? null : notificationStatus);
var expectedNotificationStatus = notificationStatusNull ? null : notificationStatus;
await sutProvider.GetDependency<IEnumerable<IPushNotificationService>>()
.First()
.Received(1)
.PushSyncNotificationAsync(notification);
.PushSyncNotificationCreateAsync(notification, expectedNotificationStatus);
}
[Theory]
[BitAutoData(false)]
[BitAutoData(true)]
[NotificationCustomize]
[NotificationStatusCustomize]
public async Task PushSyncNotificationUpdateAsync_Notification_Sent(bool notificationStatusNull,
SutProvider<MultiServicePushNotificationService> sutProvider, Notification notification,
NotificationStatus notificationStatus)
{
await sutProvider.Sut.PushSyncNotificationUpdateAsync(notification,
notificationStatusNull ? null : notificationStatus);
var expectedNotificationStatus = notificationStatusNull ? null : notificationStatus;
await sutProvider.GetDependency<IEnumerable<IPushNotificationService>>()
.First()
.Received(1)
.PushSyncNotificationUpdateAsync(notification, expectedNotificationStatus);
}
[Theory]