From 4038433873eecc0593e73ecd2c946e715e6209b2 Mon Sep 17 00:00:00 2001 From: "marcin.cebo" Date: Wed, 30 Oct 2024 17:26:00 +0100 Subject: [PATCH] Modified tests. --- .../pubnub/contract/history/step/WhenSteps.kt | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/contract/history/step/WhenSteps.kt b/pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/contract/history/step/WhenSteps.kt index 7655c9e53..52ee314a7 100644 --- a/pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/contract/history/step/WhenSteps.kt +++ b/pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/contract/history/step/WhenSteps.kt @@ -11,8 +11,22 @@ import org.hamcrest.Matchers.contains import org.junit.jupiter.api.Assertions.assertEquals class WhenSteps(private val world: World, private val historyState: HistoryState) { - @When("I fetch message history for {string} channel") - fun i_fetch_message_history_for_channel(channelName: String) { + @When("I fetch message history with messageType for {string} channel") + fun i_fetch_message_history_with_messageType_for_channel(channelName: String) { + try { + historyState.messages = world.pubnub.fetchMessages( + channels = listOf(channelName), + includeMessageType = true, // default is true but to emphasize + ).sync() + world.responseStatus = 200 + } catch (ex: PubNubException) { + world.responseStatus = ex.statusCode + world.pnException = ex + } + } + + @When("I fetch message history with customMessageType for {string} channel") + fun i_fetch_message_history_with_customMessageType_for_channel(channelName: String) { try { historyState.messages = world.pubnub.fetchMessages( channels = listOf(channelName), @@ -25,7 +39,7 @@ class WhenSteps(private val world: World, private val historyState: HistoryState } } - @When("I fetch message history with {string} set to {string} for {string} channel") // todo fix it + @When("I fetch message history with {string} set to {string} for {string} channel") fun i_fetch_message_history_with_includeCustomMessageType_set_to_false_for_channel( customMessageTypeName: String, customMessageTypeValue: String,