Skip to content

Commit

Permalink
Typing indicator tests had timing issues (#3292)
Browse files Browse the repository at this point in the history
  • Loading branch information
laevandus authored Jul 10, 2024
1 parent 980e08b commit 43998b5
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2977,7 +2977,7 @@ final class ChannelController_Tests: XCTestCase {

func test_keystroke() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [ChannelCapability.sendTypingEvents.rawValue])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand Down Expand Up @@ -3013,7 +3013,7 @@ final class ChannelController_Tests: XCTestCase {

func test_keystroke_withParentMessageId() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [ChannelCapability.sendTypingEvents.rawValue])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand Down Expand Up @@ -3048,7 +3048,7 @@ final class ChannelController_Tests: XCTestCase {

func test_startTyping() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [ChannelCapability.sendTypingEvents.rawValue])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand Down Expand Up @@ -3084,7 +3084,7 @@ final class ChannelController_Tests: XCTestCase {

func test_startTyping_withParentMessageId() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [ChannelCapability.sendTypingEvents.rawValue])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand Down Expand Up @@ -3119,7 +3119,7 @@ final class ChannelController_Tests: XCTestCase {

func test_stopTyping() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [ChannelCapability.sendTypingEvents.rawValue])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand Down Expand Up @@ -3155,7 +3155,7 @@ final class ChannelController_Tests: XCTestCase {

func test_stopTyping_withParentMessageId() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [ChannelCapability.sendTypingEvents.rawValue])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand Down Expand Up @@ -3190,7 +3190,7 @@ final class ChannelController_Tests: XCTestCase {

func test_sendKeystrokeEvent_whenTypingEventsAreDisabled_doesNothing() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand All @@ -3209,7 +3209,7 @@ final class ChannelController_Tests: XCTestCase {

func test_sendStartTypingEvent_whenTypingEventsAreDisabled_errors() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand All @@ -3235,7 +3235,7 @@ final class ChannelController_Tests: XCTestCase {

func test_sendStopTypingEvent_whenTypingEventsAreDisabled_errors() throws {
let payload = dummyPayload(with: channelId, ownCapabilities: [])
try client.databaseContainer.writeSynchronously { session in
writeAndWaitForMessageUpdates(count: payload.messages.count, channelChanges: true) { session in
try session.saveChannel(payload: payload)
}

Expand All @@ -3261,7 +3261,7 @@ final class ChannelController_Tests: XCTestCase {

func test_keystroke_keepsControllerAlive() throws {
// Save channel with typing events enabled to database
try client.mockDatabaseContainer.writeSynchronously {
writeAndWaitForMessageUpdates(count: 1, channelChanges: true) {
try $0.saveChannel(
payload: self.dummyPayload(
with: self.channelId,
Expand All @@ -3283,7 +3283,7 @@ final class ChannelController_Tests: XCTestCase {

func test_startTyping_keepsControllerAlive() throws {
// Save channel with typing events enabled to database
try client.mockDatabaseContainer.writeSynchronously {
writeAndWaitForMessageUpdates(count: 1, channelChanges: true) {
try $0.saveChannel(
payload: self.dummyPayload(
with: self.channelId,
Expand All @@ -3305,7 +3305,7 @@ final class ChannelController_Tests: XCTestCase {

func test_stopTyping_keepsControllerAlive() throws {
// Save channel with typing events enabled to database
try client.mockDatabaseContainer.writeSynchronously {
writeAndWaitForMessageUpdates(count: 1, channelChanges: true) {
try $0.saveChannel(
payload: self.dummyPayload(
with: self.channelId,
Expand Down

0 comments on commit 43998b5

Please sign in to comment.