Skip to content

Commit

Permalink
Flaky queued Notifications test (#357)
Browse files Browse the repository at this point in the history
* fix: OwnSharedAttributeDeletedByOwnerNotificationItem not yet processed

* fix: did not wait for running Message received event handler
  • Loading branch information
britsta authored Dec 4, 2024
1 parent 20398db commit c3f5ac2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/runtime/test/transport/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
MessageReceivedEvent,
MessageSentEvent,
MessageWasReadAtChangedEvent,
OwnSharedAttributeDeletedByOwnerEvent,
OwnSharedAttributeSucceededEvent,
PeerDeletionCancelledEvent,
PeerToBeDeletedEvent,
Expand Down Expand Up @@ -448,6 +449,7 @@ describe("Postponed Notifications via Messages", () => {

const postponedMessages = await syncUntilHasMessages(client5.transport);
expect(postponedMessages).toHaveLength(1);
await client5.eventBus.waitForRunningEventHandlers();
const postponedNotification = await client5.consumption.notifications.getNotification({ id: notificationId.toString() });
expect(postponedNotification).toBeSuccessful();
});
Expand Down Expand Up @@ -508,6 +510,8 @@ describe("Postponed Notifications via Messages", () => {
const postponedDeletionNotification = await client5.consumption.notifications.getNotification({ id: notifyAboutDeletionResult.notificationId });
expect(postponedDeletionNotification).toBeSuccessful();

await client5.eventBus.waitForEvent(OwnSharedAttributeDeletedByOwnerEvent);

const peerSharedIdentityAttribute = (await client5.consumption.attributes.getAttribute({ id: ownSharedIdentityAttribute.id })).value;
assert(peerSharedIdentityAttribute.succeededBy);
assert(peerSharedIdentityAttribute.deletionInfo?.deletionDate);
Expand Down

0 comments on commit c3f5ac2

Please sign in to comment.