@@ -36,7 +36,7 @@ class StartTunnelOperationTests: XCTestCase {
36
36
)
37
37
38
38
func makeInteractor( deviceState: DeviceState , tunnelState: TunnelState ? = nil ) -> MockTunnelInteractor {
39
- var interactor = MockTunnelInteractor (
39
+ let interactor = MockTunnelInteractor (
40
40
isConfigurationLoaded: true ,
41
41
settings: LatestTunnelSettings ( ) ,
42
42
deviceState: deviceState
@@ -50,8 +50,7 @@ class StartTunnelOperationTests: XCTestCase {
50
50
// MARK: the tests
51
51
52
52
func testFailsIfNotLoggedIn( ) throws {
53
- let settings = LatestTunnelSettings ( )
54
- let exp = expectation ( description: " Start tunnel operation failed " )
53
+ let expectation = expectation ( description: " Start tunnel operation failed " )
55
54
let operation = StartTunnelOperation (
56
55
dispatchQueue: testQueue,
57
56
interactor: makeInteractor ( deviceState: . loggedOut)
@@ -60,16 +59,15 @@ class StartTunnelOperationTests: XCTestCase {
60
59
XCTFail ( " Operation returned \( result) , not failure " )
61
60
return
62
61
}
63
- exp . fulfill ( )
62
+ expectation . fulfill ( )
64
63
}
65
64
66
65
operationQueue. addOperation ( operation)
67
- wait ( for: [ exp ] , timeout: 1.0 )
66
+ wait ( for: [ expectation ] , timeout: 1.0 )
68
67
}
69
68
70
69
func testSetsReconnectIfDisconnecting( ) {
71
- let settings = LatestTunnelSettings ( )
72
- var interactor = makeInteractor ( deviceState: loggedInDeviceState, tunnelState: . disconnecting( . nothing) )
70
+ let interactor = makeInteractor ( deviceState: loggedInDeviceState, tunnelState: . disconnecting( . nothing) )
73
71
var tunnelStatus = TunnelStatus ( )
74
72
interactor. onUpdateTunnelStatus = { status in tunnelStatus = status }
75
73
let expectation = expectation ( description: " Tunnel status set to reconnect " )
@@ -86,8 +84,7 @@ class StartTunnelOperationTests: XCTestCase {
86
84
}
87
85
88
86
func testStartsTunnelIfDisconnected( ) {
89
- let settings = LatestTunnelSettings ( )
90
- var interactor = makeInteractor ( deviceState: loggedInDeviceState, tunnelState: . disconnected)
87
+ let interactor = makeInteractor ( deviceState: loggedInDeviceState, tunnelState: . disconnected)
91
88
let expectation = expectation ( description: " Make tunnel provider and start tunnel " )
92
89
let operation = StartTunnelOperation (
93
90
dispatchQueue: testQueue,
0 commit comments