@@ -42,39 +42,24 @@ final class LaunchAtLoginControllerTests: XCTestCase {
4242 }
4343
4444 func testIsEnabledReturnsSetValue( ) {
45- mockController. isEnabledValue = true
46- XCTAssertTrue ( mockController. isEnabled ( ) )
47-
48- mockController. isEnabledValue = false
49- XCTAssertFalse ( mockController. isEnabled ( ) )
45+ for expected in [ true , false ] {
46+ mockController. isEnabledValue = expected
47+ XCTAssertEqual ( mockController. isEnabled ( ) , expected)
48+ }
5049 }
5150
5251 // MARK: - setEnabled() Tests
5352
54- func testSetEnabledToTrueCallsCompletion( ) {
55- let expectation = XCTestExpectation ( description: " Enable completion " )
53+ func testSetEnabledCallsCompletion( ) {
54+ for enabled in [ true , false ] {
55+ let expectation = XCTestExpectation ( description: " Completion for \( enabled) " )
5656
57- mockController. setEnabled ( true ) { result in
58- switch result {
59- case . success, . failure:
57+ mockController. setEnabled ( enabled) { _ in
6058 expectation. fulfill ( )
6159 }
62- }
63-
64- wait ( for: [ expectation] , timeout: 5.0 )
65- }
6660
67- func testSetEnabledToFalseCallsCompletion( ) {
68- let expectation = XCTestExpectation ( description: " Disable completion " )
69-
70- mockController. setEnabled ( false ) { result in
71- switch result {
72- case . success, . failure:
73- expectation. fulfill ( )
74- }
61+ wait ( for: [ expectation] , timeout: 5.0 )
7562 }
76-
77- wait ( for: [ expectation] , timeout: 5.0 )
7863 }
7964
8065 func testSetEnabledReturnsSuccess( ) {
0 commit comments