Skip to content

Commit

Permalink
Use some HBBaseRequestContext in request handler tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Nov 21, 2023
1 parent 51a8bcb commit acf5682
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Tests/HummingbirdTests/HandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class HandlerTests: XCTestCase {
struct DecodeTest: HBRequestDecodable {
let name: String

func handle<Context: HBBaseRequestContext>(request: HBRequest, context: Context) -> String {
func handle(request: HBRequest, context: some HBBaseRequestContext) -> String {
return "Hello \(self.name)"
}
}
Expand Down Expand Up @@ -53,7 +53,7 @@ final class HandlerTests: XCTestCase {
struct DecodeTest: HBRequestDecodable {
let value: Int

func handle<Context: HBBaseRequestContext>(request: HBRequest, context: Context) -> String {
func handle(request: HBRequest, context: some HBBaseRequestContext) -> String {
return "Value: \(self.value)"
}
}
Expand Down Expand Up @@ -83,7 +83,7 @@ final class HandlerTests: XCTestCase {
struct DecodeTest: HBRequestDecodable {
let name: String

func handle<Context: HBBaseRequestContext>(request: HBRequest, context: Context) -> String {
func handle(request: HBRequest, context: some HBBaseRequestContext) -> String {
return "Hello \(self.name)"
}
}
Expand Down Expand Up @@ -118,7 +118,7 @@ final class HandlerTests: XCTestCase {
struct DecodeTest: HBRequestDecodable {
let name: String

func handle<Context: HBBaseRequestContext>(request: HBRequest, context: Context) -> String {
func handle(request: HBRequest, context: some HBBaseRequestContext) -> String {
return "Hello \(self.name)"
}
}
Expand Down Expand Up @@ -147,7 +147,7 @@ final class HandlerTests: XCTestCase {
func testDecode() async throws {
struct DecodeTest: HBRequestDecodable {
let name: String
func handle<Context: HBBaseRequestContext>(request: HBRequest, context: Context) -> String {
func handle(request: HBRequest, context: some HBBaseRequestContext) -> String {
return "Hello \(self.name)"
}
}
Expand All @@ -168,7 +168,7 @@ final class HandlerTests: XCTestCase {
func testDecodeFutureResponse() async throws {
struct DecodeTest: HBRequestDecodable {
let name: String
func handle<Context: HBBaseRequestContext>(request: HBRequest, context: Context) -> String {
func handle(request: HBRequest, context: some HBBaseRequestContext) -> String {
"Hello \(self.name)"
}
}
Expand All @@ -190,7 +190,7 @@ final class HandlerTests: XCTestCase {
struct DecodeTest: HBRequestDecodable {
let name: String

func handle<Context: HBBaseRequestContext>(request: HBRequest, context: Context) -> HTTPResponseStatus {
func handle(request: HBRequest, context: some HBBaseRequestContext) -> HTTPResponseStatus {
return .ok
}
}
Expand All @@ -209,11 +209,11 @@ final class HandlerTests: XCTestCase {
func testEmptyRequest() async throws {
struct ParameterTest: HBRouteHandler {
let parameter: Int
init<Context: HBBaseRequestContext>(from request: HBRequest, context: Context) throws {
init(from request: HBRequest, context: some HBBaseRequestContext) throws {
self.parameter = try context.parameters.require("test", as: Int.self)
}

func handle<Context: HBBaseRequestContext>(request: HBRequest, context: Context) -> String {
func handle(request: HBRequest, context: some HBBaseRequestContext) -> String {
return "\(self.parameter)"
}
}
Expand Down

0 comments on commit acf5682

Please sign in to comment.