|
@@ -101,8 +101,14 @@ mod test {
|
|
|
// responsibility of the implementor to make sure that SubId are unique
|
|
|
// either globally or per client
|
|
|
let subscriptions = vec![
|
|
|
- manager.subscribe(params.clone()).await,
|
|
|
- manager.subscribe(params).await,
|
|
|
+ manager
|
|
|
+ .try_subscribe(params.clone())
|
|
|
+ .await
|
|
|
+ .expect("valid subscription"),
|
|
|
+ manager
|
|
|
+ .try_subscribe(params)
|
|
|
+ .await
|
|
|
+ .expect("valid subscription"),
|
|
|
];
|
|
|
assert_eq!(2, manager.active_subscriptions());
|
|
|
drop(subscriptions);
|
|
@@ -117,7 +123,7 @@ mod test {
|
|
|
let manager = PubSubManager::default();
|
|
|
let mut subscriptions = [
|
|
|
manager
|
|
|
- .subscribe(Params {
|
|
|
+ .try_subscribe(Params {
|
|
|
kind: Kind::ProofState,
|
|
|
filters: vec![
|
|
|
"02194603ffa36356f4a56b7df9371fc3192472351453ec7398b8da8117e7c3e104"
|
|
@@ -125,9 +131,10 @@ mod test {
|
|
|
],
|
|
|
id: "uno".into(),
|
|
|
})
|
|
|
- .await,
|
|
|
+ .await
|
|
|
+ .expect("valid subscription"),
|
|
|
manager
|
|
|
- .subscribe(Params {
|
|
|
+ .try_subscribe(Params {
|
|
|
kind: Kind::ProofState,
|
|
|
filters: vec![
|
|
|
"02194603ffa36356f4a56b7df9371fc3192472351453ec7398b8da8117e7c3e104"
|
|
@@ -135,7 +142,8 @@ mod test {
|
|
|
],
|
|
|
id: "dos".into(),
|
|
|
})
|
|
|
- .await,
|
|
|
+ .await
|
|
|
+ .expect("valid subscription"),
|
|
|
];
|
|
|
|
|
|
let event = ProofState {
|
|
@@ -174,11 +182,11 @@ mod test {
|
|
|
async fn json_test() {
|
|
|
let manager = PubSubManager::default();
|
|
|
let mut subscription = manager
|
|
|
- .subscribe::<Params>(
|
|
|
+ .try_subscribe::<Params>(
|
|
|
serde_json::from_str(r#"{"kind":"proof_state","filters":["02194603ffa36356f4a56b7df9371fc3192472351453ec7398b8da8117e7c3e104"],"subId":"uno"}"#)
|
|
|
.expect("valid json"),
|
|
|
)
|
|
|
- .await;
|
|
|
+ .await.expect("valid subscription");
|
|
|
|
|
|
manager.broadcast(
|
|
|
ProofState {
|