@@ -9,7 +9,7 @@ final class AppTests: XCTestCase {
99 var params : FooParameters
1010 }
1111
12- func setupAppForTesting( hookKey: String ? = nil ) throws -> Application {
12+ func setupAppForTesting( hookKey: String ? = nil ) async throws -> Application {
1313 let app = Application ( . testing)
1414 let configuration = try ParseServerConfiguration ( app: app,
1515 hostName: " hostName " ,
@@ -19,6 +19,18 @@ final class AppTests: XCTestCase {
1919 webhookKey: hookKey,
2020 parseServerURLString: " primaryKey " )
2121 try ParseServerSwift . initialize ( configuration, app: app, testing: true )
22+ guard let parseServerURL = URL ( string: configuration. primaryParseServerURLString) else {
23+ throw ParseError ( code: . otherCause,
24+ message: " Could not make a URL from the Parse Server string " )
25+ }
26+ try await ParseSwift . initialize ( applicationId: configuration. applicationId,
27+ primaryKey: configuration. primaryKey,
28+ serverURL: parseServerURL,
29+ usingPostForQuery: true ,
30+ requestCachePolicy: . reloadIgnoringLocalCacheData) { _, completionHandler in
31+ // Setup to use default certificate pinning. See Parse-Swift docs for more info
32+ completionHandler ( . performDefaultHandling, nil )
33+ }
2234 try routes ( app)
2335 return app
2436 }
@@ -41,8 +53,8 @@ final class AppTests: XCTestCase {
4153 XCTAssertNoThrow ( try setConfiguration ( configuration) )
4254 }
4355
44- func testDoNotInitConfigTwice( ) throws {
45- let app = try setupAppForTesting ( )
56+ func testDoNotInitConfigTwice( ) async throws {
57+ let app = try await setupAppForTesting ( )
4658 defer { app. shutdown ( ) }
4759 let configuration = try ParseServerConfiguration ( app: app,
4860 hostName: " hostName " ,
@@ -53,8 +65,8 @@ final class AppTests: XCTestCase {
5365 XCTAssertThrowsError ( try setConfiguration ( configuration) )
5466 }
5567
56- func testFooBar( ) throws {
57- let app = try setupAppForTesting ( )
68+ func testFooBar( ) async throws {
69+ let app = try await setupAppForTesting ( )
5870 defer { app. shutdown ( ) }
5971
6072 try app. test ( . GET, " foo " , afterResponse: { res in
@@ -64,7 +76,7 @@ final class AppTests: XCTestCase {
6476 }
6577
6678 func testCheckServerHealth( ) async throws {
67- let app = try setupAppForTesting ( )
79+ let app = try await setupAppForTesting ( )
6880 defer { app. shutdown ( ) }
6981
7082 XCTAssertGreaterThan ( configuration. parseServerURLStrings. count, 0 )
@@ -93,7 +105,7 @@ final class AppTests: XCTestCase {
93105 }
94106
95107 func testDeleteHooks( ) async throws {
96- let app = try setupAppForTesting ( )
108+ let app = try await setupAppForTesting ( )
97109 defer { app. shutdown ( ) }
98110
99111 let urlString = " https://parse.com/parse "
@@ -122,8 +134,8 @@ final class AppTests: XCTestCase {
122134 XCTAssertEqual ( currentTriggers2. count, 0 )
123135 }
124136
125- func testFunctionWebhookKeyNotEqual( ) throws {
126- let app = try setupAppForTesting ( hookKey: " wow " )
137+ func testFunctionWebhookKeyNotEqual( ) async throws {
138+ let app = try await setupAppForTesting ( hookKey: " wow " )
127139 defer { app. shutdown ( ) }
128140
129141 try app. test ( . POST, " hello " , afterResponse: { res in
@@ -132,8 +144,8 @@ final class AppTests: XCTestCase {
132144 } )
133145 }
134146
135- func testTriggerWebhookKeyNotEqual( ) throws {
136- let app = try setupAppForTesting ( hookKey: " wow " )
147+ func testTriggerWebhookKeyNotEqual( ) async throws {
148+ let app = try await setupAppForTesting ( hookKey: " wow " )
137149 defer { app. shutdown ( ) }
138150
139151 try app. test ( . POST, " score/save/before " , afterResponse: { res in
@@ -143,7 +155,7 @@ final class AppTests: XCTestCase {
143155 }
144156
145157 func testMatchServerURLString( ) async throws {
146- let app = try setupAppForTesting ( )
158+ let app = try await setupAppForTesting ( )
147159 defer { app. shutdown ( ) }
148160 let urlString = " https://parse.com/parse "
149161 let uri = URI ( stringLiteral: urlString)
@@ -162,7 +174,7 @@ final class AppTests: XCTestCase {
162174 }
163175
164176 func testMatchServerURLStringThrowsError( ) async throws {
165- let app = try setupAppForTesting ( )
177+ let app = try await setupAppForTesting ( )
166178 ParseServer . configuration. parseServerURLStrings. removeAll ( )
167179 defer { app. shutdown ( ) }
168180 let urlString = " https://parse.com/parse "
@@ -172,7 +184,7 @@ final class AppTests: XCTestCase {
172184 }
173185
174186 func testParseHookOptions( ) async throws {
175- let app = try setupAppForTesting ( )
187+ let app = try await setupAppForTesting ( )
176188 defer { app. shutdown ( ) }
177189 let installationId = " naw "
178190 let urlString = " https://parse.com/parse "
0 commit comments