Update milk tea redeem dialog and notifications

This commit is contained in:
Tim
2025-07-28 15:59:09 +08:00
parent 54bf778977
commit de7a2c5b80
4 changed files with 63 additions and 12 deletions

View File

@@ -96,4 +96,23 @@ class NotificationServiceTest {
verify(nRepo).deleteByTypeAndFromUser(NotificationType.REGISTER_REQUEST, applicant);
verify(nRepo).save(any(Notification.class));
}
@Test
void createActivityRedeemNotificationsDeletesOldOnes() {
NotificationRepository nRepo = mock(NotificationRepository.class);
UserRepository uRepo = mock(UserRepository.class);
NotificationService service = new NotificationService(nRepo, uRepo);
User admin = new User();
admin.setId(10L);
User user = new User();
user.setId(20L);
when(uRepo.findByRole(Role.ADMIN)).thenReturn(List.of(admin));
service.createActivityRedeemNotifications(user, "contact");
verify(nRepo).deleteByTypeAndFromUser(NotificationType.ACTIVITY_REDEEM, user);
verify(nRepo).save(any(Notification.class));
}
}