Skip to content

Commit

Permalink
Modified tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-cebo committed Oct 30, 2024
1 parent 2d1a606 commit 4038433
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
Expand Down

0 comments on commit 4038433

Please sign in to comment.