@@ -34,18 +34,21 @@ final class RegistryManagerTests: XCTestCase {
34
34
XCTAssertResultSuccess ( result)
35
35
}
36
36
37
- wait ( for: [ expectation] , timeout: 10.0 )
37
+ self . wait ( for: [ expectation] , timeout: 10.0 )
38
38
}
39
39
40
40
func testFetchVersions( ) {
41
41
let package = PackageReference ( identity: " github.com/mona/LinkedList " . lowercased ( ) , path: " /LinkedList " )
42
42
let expectation = XCTestExpectation ( description: " discover package registry " )
43
- let nestedExpectation = XCTestExpectation ( description: " fetch versions " )
44
43
45
44
RegistryManager . discover ( for: package ) { result in
46
45
defer { expectation. fulfill ( ) }
46
+
47
+ XCTAssertResultSuccess ( result)
47
48
guard case . success( let manager) = result else { return }
48
49
50
+ let nestedExpectation = XCTestExpectation ( description: " fetch versions " )
51
+
49
52
manager. fetchVersions ( of: package ) { result in
50
53
defer { nestedExpectation. fulfill ( ) }
51
54
@@ -55,22 +58,27 @@ final class RegistryManagerTests: XCTestCase {
55
58
XCTAssertEqual ( versions, [ " 1.1.1 " , " 1.0.0 " ] )
56
59
XCTAssertFalse ( versions. contains ( " 1.1.0 " ) , " problematic releases shouldn't be included " )
57
60
}
61
+
62
+ self . wait ( for: [ nestedExpectation] , timeout: 10.0 )
58
63
}
59
64
60
- wait ( for: [ expectation, nestedExpectation ] , timeout: 10.0 )
65
+ self . wait ( for: [ expectation] , timeout: 10.0 )
61
66
}
62
67
63
68
func testFetchManifest( ) {
64
69
let package = PackageReference ( identity: " github.com/mona/LinkedList " . lowercased ( ) , path: " /LinkedList " )
65
70
let expectation = XCTestExpectation ( description: " discover package registry " )
66
- let nestedExpectation = XCTestExpectation ( description: " fetch manifest " )
67
71
68
72
RegistryManager . discover ( for: package ) { result in
69
73
defer { expectation. fulfill ( ) }
74
+
75
+ XCTAssertResultSuccess ( result)
70
76
guard case . success( let manager) = result else { return }
71
77
72
78
let manifestLoader = ManifestLoader ( manifestResources: Resources . default)
73
79
80
+ let nestedExpectation = XCTestExpectation ( description: " fetch manifest " )
81
+
74
82
manager. fetchManifest ( for: " 1.1.1 " , of: package , using: manifestLoader) { result in
75
83
defer { nestedExpectation. fulfill ( ) }
76
84
@@ -91,22 +99,28 @@ final class RegistryManagerTests: XCTestCase {
91
99
92
100
XCTAssertEqual ( manifest. swiftLanguageVersions, [ . v4, . v5] )
93
101
}
102
+
103
+ self . wait ( for: [ nestedExpectation] , timeout: 10.0 )
94
104
}
95
105
96
- wait ( for: [ expectation, nestedExpectation ] , timeout: 10.0 )
106
+ self . wait ( for: [ expectation] , timeout: 10.0 )
97
107
}
98
108
99
109
func testDownloadSourceArchive( ) {
100
110
let package = PackageReference ( identity: " github.com/mona/LinkedList " . lowercased ( ) , path: " /LinkedList " )
101
111
let expectation = XCTestExpectation ( description: " discover package registry " )
102
- let nestedExpectation = XCTestExpectation ( description: " fetch manifest " )
103
112
104
113
RegistryManager . discover ( for: package ) { result in
105
114
defer { expectation. fulfill ( ) }
115
+
116
+ XCTAssertResultSuccess ( result)
106
117
guard case . success( let manager) = result else { return }
107
118
108
119
let fs = InMemoryFileSystem ( )
109
120
let path = AbsolutePath ( " /LinkedList-1.1.1.zip " )
121
+
122
+ let nestedExpectation = XCTestExpectation ( description: " fetch manifest " )
123
+
110
124
manager. downloadSourceArchive ( for: " 1.1.1 " , of: package , into: fs, at: path) { result in
111
125
defer { nestedExpectation. fulfill ( ) }
112
126
@@ -118,8 +132,10 @@ final class RegistryManagerTests: XCTestCase {
118
132
XCTAssertEqual ( data, emptyZipFile)
119
133
}
120
134
}
135
+
136
+ self . wait ( for: [ nestedExpectation] , timeout: 10.0 )
121
137
}
122
138
123
- wait ( for: [ expectation, nestedExpectation ] , timeout: 10.0 )
139
+ self . wait ( for: [ expectation] , timeout: 10.0 )
124
140
}
125
141
}
0 commit comments