Skip to content

Commit

Permalink
Updated RSH8d and RSH8f tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
maratal committed Jan 14, 2024
1 parent 1bb7d48 commit ef19492
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Test/Tests/PushTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,11 @@ class PushTests: XCTestCase {
}

let realtime = ARTRealtime(options: options)
realtime.internal.rest.storage = MockDeviceStorage()
let storage = MockDeviceStorage()
realtime.internal.rest.storage = storage

XCTAssertNil(realtime.device.clientId)
XCTAssertNil(storage.keysWritten[ARTClientIdKey] as? String)

waitUntil(timeout: testTimeout) { done in
realtime.auth.authorize { _, _ in
Expand All @@ -272,6 +274,7 @@ class PushTests: XCTestCase {
}

XCTAssertEqual(realtime.device.clientId, "testClient")
XCTAssertEqual(storage.keysWritten[ARTClientIdKey] as? String, "testClient")
}

// RSH8d
Expand All @@ -282,10 +285,12 @@ class PushTests: XCTestCase {
options.testOptions.transportFactory = TestProxyTransportFactory()

let realtime = ARTRealtime(options: options)
realtime.internal.rest.storage = MockDeviceStorage()
let storage = MockDeviceStorage()
realtime.internal.rest.storage = storage

XCTAssertNil(realtime.device.clientId)

XCTAssertNil(storage.keysWritten[ARTClientIdKey] as? String)

waitUntil(timeout: testTimeout) { done in
realtime.connection.once(.connected) { _ in
done()
Expand All @@ -298,6 +303,7 @@ class PushTests: XCTestCase {
}

XCTAssertEqual(realtime.device.clientId, "testClient")
XCTAssertEqual(storage.keysWritten[ARTClientIdKey] as? String, "testClient")
}

// RSH8e
Expand Down Expand Up @@ -387,9 +393,12 @@ class PushTests: XCTestCase {
clientId: expectedClientId
)
}
let storage = MockDeviceStorage()
rest.internal.storage = storage
rest.push.internal.activationMachine.delegate = stateMachineDelegate

XCTAssertNil(rest.device.clientId)
XCTAssertNil(storage.keysWritten[ARTClientIdKey] as? String)

waitUntil(timeout: testTimeout) { done in
stateMachineDelegate.onDidActivateAblyPush = { _ in
Expand All @@ -402,6 +411,7 @@ class PushTests: XCTestCase {
}

XCTAssertEqual(rest.device.clientId, expectedClientId)
XCTAssertEqual(storage.keysWritten[ARTClientIdKey] as? String, expectedClientId)
}

func test__014__Registerer_Delegate_option__a_successful_activation_should_call_the_correct_registerer_delegate_method() throws {
Expand Down

0 comments on commit ef19492

Please sign in to comment.