Skip to content

Commit

Permalink
PM-10600: Broken NotificationsController integration test
Browse files Browse the repository at this point in the history
Device type is now part of JWT access token, so the notification center results in the integration test are now scoped to client type web and all.
  • Loading branch information
mzieniukbw committed Dec 18, 2024
1 parent f1675ae commit 1962e8b
Showing 1 changed file with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,10 @@ public async Task ListAsync_NotLoggedIn_Unauthorized()
[InlineData(null, null, "2", 10)]
[InlineData(10, null, "2", 10)]
[InlineData(10, 2, "3", 10)]
[InlineData(10, 3, null, 0)]
[InlineData(15, null, "2", 15)]
[InlineData(15, 2, null, 5)]
[InlineData(20, null, "2", 20)]
[InlineData(20, 2, null, 0)]
[InlineData(1000, null, null, 20)]
[InlineData(10, 3, null, 4)]
[InlineData(24, null, "2", 24)]
[InlineData(24, 2, null, 0)]
[InlineData(1000, null, null, 24)]
public async Task ListAsync_PaginationFilter_ReturnsNextPageOfNotificationsCorrectOrder(
int? pageSize, int? pageNumber, string? expectedContinuationToken, int expectedCount)
{
Expand Down Expand Up @@ -505,11 +503,12 @@ private static void AssertNotificationResponseModels(
userPartOrOrganizationNotificationWithStatuses
}
.SelectMany(n => n)
.Where(n => n.Item1.ClientType is ClientType.All or ClientType.Web)
.ToList();
}

private async Task<List<Notification>> CreateNotificationsAsync(Guid? userId = null, Guid? organizationId = null,
int numberToCreate = 5)
int numberToCreate = 3)
{
var priorities = Enum.GetValues<Priority>();
var clientTypes = Enum.GetValues<ClientType>();
Expand Down Expand Up @@ -570,13 +569,9 @@ private async Task<List<Notification>> CreateNotificationsAsync(Guid? userId = n
DeletedDate = DateTime.UtcNow - TimeSpan.FromMinutes(_random.Next(3600))
});

return
[
(notifications[0], readDateNotificationStatus),
(notifications[1], deletedDateNotificationStatus),
(notifications[2], readDateAndDeletedDateNotificationStatus),
(notifications[3], null),
(notifications[4], null)
];
List<NotificationStatus> statuses =
[readDateNotificationStatus, deletedDateNotificationStatus, readDateAndDeletedDateNotificationStatus];

return notifications.Select(n => (n, statuses.Find(s => s.NotificationId == n.Id))).ToList();
}
}

0 comments on commit 1962e8b

Please sign in to comment.