Skip to content

Commit

Permalink
test: fix contract tests
Browse files Browse the repository at this point in the history
  • Loading branch information
parfeon committed Jan 25, 2024
1 parent a27211d commit b718ec5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 2 additions & 3 deletions tests/presence/presence_steps.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use cucumber::gherkin::Table;
use cucumber::{codegen::Regex, gherkin::Step, then, when};
use futures::{select_biased, FutureExt, StreamExt};
use log::Log;
use std::collections::HashMap;
use std::fs::read_to_string;

Expand Down Expand Up @@ -153,7 +152,7 @@ async fn leave(
world: &mut PubNubWorld,
channel_a: String,
channel_b: String,
with_presence: String,
_with_presence: String,
) {
let mut subscription = world.subscription.clone().unwrap();
let subscriptions = world.subscriptions.clone().unwrap().iter().fold(
Expand Down Expand Up @@ -209,7 +208,7 @@ async fn receive_an_error_heartbeat_retry(world: &mut PubNubWorld) {
}

#[then("I don't observe any Events and Invocations of the Presence EE")]
async fn event_engine_history_empty(_world: &mut PubNubWorld, step: &Step) {
async fn event_engine_history_empty(_world: &mut PubNubWorld, _step: &Step) {
assert_eq!(events_and_invocations_history().len(), 0);
}

Expand Down
14 changes: 11 additions & 3 deletions tests/subscribe/subscribe_steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cucumber::gherkin::Table;
use cucumber::{codegen::Regex, gherkin::Step, then, when};
use futures::{select_biased, FutureExt, StreamExt};
use pubnub::core::RequestRetryConfiguration;
use pubnub::subscribe::{EventEmitter, EventSubscriber};
use pubnub::subscribe::{EventEmitter, EventSubscriber, SubscriptionParams};
use std::fs::read_to_string;

/// Extract list of events and invocations from log.
Expand Down Expand Up @@ -117,7 +117,11 @@ async fn subscribe(world: &mut PubNubWorld) {
world.pubnub = Some(world.get_pubnub(world.keyset.to_owned()));

world.pubnub.clone().map(|pubnub| {
let subscription = pubnub.subscription(Some(&["test"]), None, None);
let subscription = pubnub.subscription(SubscriptionParams {
channels: Some(&["test"]),
channel_groups: None,
options: None,
});
subscription.subscribe(None);
world.subscription = Some(subscription);
});
Expand All @@ -130,7 +134,11 @@ async fn subscribe_with_timetoken(world: &mut PubNubWorld, timetoken: u64) {
world.pubnub = Some(world.get_pubnub(world.keyset.to_owned()));

world.pubnub.clone().map(|pubnub| {
let subscription = pubnub.subscription(Some(&["test"]), None, None);
let subscription = pubnub.subscription(SubscriptionParams {
channels: Some(&["test"]),
channel_groups: None,
options: None,
});
subscription.subscribe(Some(timetoken.to_string().into()));
world.subscription = Some(subscription);
});
Expand Down

0 comments on commit b718ec5

Please sign in to comment.