summaryrefslogtreecommitdiff
path: root/src/push/handlers/ping/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/push/handlers/ping/test.rs')
-rw-r--r--src/push/handlers/ping/test.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/push/handlers/ping/test.rs b/src/push/handlers/ping/test.rs
index 5725131..3481139 100644
--- a/src/push/handlers/ping/test.rs
+++ b/src/push/handlers/ping/test.rs
@@ -2,8 +2,9 @@ use axum::{
extract::{Json, State},
http::StatusCode,
};
+use itertools::Itertools;
-use crate::test::fixtures;
+use crate::{event::Heartbeat, test::fixtures};
#[tokio::test]
async fn ping_without_subscriptions() {
@@ -11,18 +12,21 @@ async fn ping_without_subscriptions() {
let recipient = fixtures::identity::create(&app, &fixtures::now()).await;
- app.vapid()
- .refresh_key(&fixtures::now())
- .await
- .expect("refreshing the VAPID key always succeeds");
-
let response = super::handler(State(app.push()), recipient, Json(super::Request {}))
.await
.expect("sending a ping with no subscriptions always succeeds");
assert_eq!(StatusCode::ACCEPTED, response);
- assert!(app.webpush().sent().is_empty());
+ assert!(
+ app.publisher()
+ .sent()
+ .into_iter()
+ .filter(|publish| publish.message_eq(&Heartbeat::Heartbeat)
+ && publish.subscriptions.is_empty())
+ .exactly_one()
+ .is_ok()
+ );
}
// More complete testing requires that we figure out how to generate working p256 ECDH keys for