14
14
//===----------------------------------------------------------------------===//
15
15
import HTTPTypes
16
16
import OpenAPIRuntime
17
+ import Testing
17
18
18
19
@testable import OpenAPILambda
19
20
20
- // only run unit tests on Swift 6.x
21
- #if swift(>=6.0)
22
- import Testing
23
-
24
21
struct RouterGraphTests {
25
22
@Test ( " Path with no parameters " )
26
23
func testPathNoParams( ) async throws {
@@ -231,7 +228,7 @@ struct RouterGraphTests {
231
228
// let method = HTTPRequest.Method(strMethod)!
232
229
// let graph = prepareGraph(for: method)
233
230
//
234
- // let root: Node ? = graph.root()
231
+ // let root: node ? = graph.root()
235
232
// XCTAssertNotNil(root)
236
233
//
237
234
// // when
@@ -323,9 +320,8 @@ struct RouterGraphTests {
323
320
324
321
//when
325
322
#expect( throws: Never . self) { try graph. find ( method: method, path: pathToTest) }
326
- let ( handler , metadata) = try graph. find ( method: method, path: pathToTest)
323
+ let ( _ , metadata) = try graph. find ( method: method, path: pathToTest)
327
324
#expect( metadata. count == 0 )
328
- #expect( handler != nil )
329
325
}
330
326
331
327
@Test (
@@ -338,19 +334,18 @@ struct RouterGraphTests {
338
334
)
339
335
func testFindHandler2(
340
336
pathToTest: String
341
- ) throws {
337
+ ) async throws {
342
338
// given
343
339
let strMethod = " GET "
344
340
let method = HTTPRequest . Method ( strMethod) !
345
341
let graph = prepareGraphForFind ( for: method)
346
342
347
343
//when
348
344
#expect( throws: Never . self) {
349
- let ( handler , metadata) = try graph. find ( method: method, path: pathToTest)
345
+ let ( _ , metadata) = try graph. find ( method: method, path: pathToTest)
350
346
351
347
// then (we can not test if the query string param have been decoded, that's the job of the openapi runtime.)
352
348
#expect( metadata. count == 1 )
353
- #expect( handler != nil )
354
349
}
355
350
356
351
}
@@ -365,9 +360,8 @@ struct RouterGraphTests {
365
360
366
361
//when
367
362
#expect( throws: Never . self) { try graph. find ( method: method, path: pathToTest) }
368
- let ( handler , metadata) = try graph. find ( method: method, path: pathToTest)
363
+ let ( _ , metadata) = try graph. find ( method: method, path: pathToTest)
369
364
#expect( metadata. count == 1 )
370
- #expect( handler != nil )
371
365
}
372
366
373
367
@Test ( " Find handler error 1 " )
@@ -440,4 +434,3 @@ struct RouterGraphTests {
440
434
}
441
435
442
436
}
443
- #endif
0 commit comments