Skip to content

Commit

Permalink
chore: test idempotency is per-client
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Nov 13, 2023
1 parent 0602fc0 commit ffabaf0
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tests/functional/stores/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,31 @@ async fn notification_multiple_clients_same_payload(ctx: &mut StoreContext) {
blob: "example-payload".to_string(),
};

let client_id = create_client(&ctx.clients).await;
let client_id1 = create_client(&ctx.clients).await;
let res = ctx
.notifications
.create_or_update_notification(&message_id, TENANT_ID, &client_id, &payload)
.create_or_update_notification(&message_id, TENANT_ID, &client_id1, &payload)
.await;
assert!(res.is_ok());

let client_id = create_client(&ctx.clients).await;
let client_id2 = create_client(&ctx.clients).await;
let res = ctx
.notifications
.create_or_update_notification(&message_id, TENANT_ID, &client_id, &payload)
.create_or_update_notification(&message_id, TENANT_ID, &client_id2, &payload)
.await;
assert!(res.is_ok());

let notification1 = ctx
.notifications
.get_notification(&message_id, &client_id1, TENANT_ID)
.await
.unwrap();
assert_eq!(notification1.client_id, client_id1);

let notification2 = ctx
.notifications
.get_notification(&message_id, &client_id2, TENANT_ID)
.await
.unwrap();
assert_eq!(notification2.client_id, client_id2);
}

0 comments on commit ffabaf0

Please sign in to comment.