Skip to content

Commit 341f655

Browse files
committed
fix NotificationsRepository.test.ts: use persistentId to test the correct notification.
1 parent df6436a commit 341f655

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

test/integration/notifications/NotificationsRepository.test.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,24 @@ describe('NotificationsRepository', () => {
3737
await publishDatasetViaApi(testDatasetIds.numericId)
3838
await waitForNoLocks(testDatasetIds.numericId, 10)
3939

40-
const notificationSubset: NotificationSubset = await sut.getAllNotificationsByUser()
40+
const notificationSubset: NotificationSubset = await sut.getAllNotificationsByUser(true)
4141

4242
expect(Array.isArray(notificationSubset.notifications)).toBe(true)
4343
expect(notificationSubset.notifications.length).toBeGreaterThan(0)
4444

4545
const publishedNotification = notificationSubset.notifications.find(
46-
(n) => n.type === NotificationType.PUBLISHEDDS
46+
(n) =>
47+
n.datasetPersistentIdentifier === testDatasetIds.persistentId &&
48+
n.type === NotificationType.PUBLISHEDDS
4749
) as Notification
4850

4951
expect(publishedNotification).toBeDefined()
5052

5153
expect(publishedNotification).toHaveProperty('id')
5254
expect(publishedNotification).toHaveProperty('type')
53-
expect(publishedNotification).toHaveProperty('subjectText')
54-
expect(publishedNotification).toHaveProperty('messageText')
55-
expect(publishedNotification).toHaveProperty('sentTimestamp')
56-
57-
expect(publishedNotification?.subjectText).toContain(
58-
`Dataset "${TestConstants.TEST_NEW_DATASET_DTO.metadataBlockValues[0].fields.title}" has been published`
59-
)
6055

61-
expect(publishedNotification?.messageText).toContain(
62-
`Your dataset named ${TestConstants.TEST_NEW_DATASET_DTO.metadataBlockValues[0].fields.title}`
56+
expect(publishedNotification?.datasetDisplayName).toContain(
57+
`${TestConstants.TEST_NEW_DATASET_DTO.metadataBlockValues[0].fields.title}`
6358
)
6459
})
6560

0 commit comments

Comments
 (0)