fix: remove trailing Whitespace
MODIFY
Tests/KituraTests/TestTypeSafeMiddleware.swift
Tests/KituraTests/TestTypeSafeMiddleware.swift
@@ -111,7 +111,6 @@ class TestTypeSafeMiddleware: KituraTest {
respondWith(user, nil)
}
-
buildServerTest(router, timeout: 30)
.request("get", path: "/userMiddleware", headers: ["TestHeader": "Hello"])
.hasStatus(.OK)
@@ -165,7 +164,6 @@ class TestTypeSafeMiddleware: KituraTest {
respondWith(userArray, nil)
}
-
buildServerTest(router, timeout: 30)
.request("get", path: "/userMiddleware", headers: ["TestHeader": "Hello"])
.hasStatus(.OK)
@@ -214,8 +212,7 @@ class TestTypeSafeMiddleware: KituraTest {
func testSingleMiddlewareGetIdentifier() {
// Expected user: User(id: 1, name: "Andy")
guard let user = userStore[1] else {
- print("no value found for userStore[1]")
- XCTFail()
+ XCTFail("no value found for userStore[1]")
return
}
@@ -225,7 +222,6 @@ class TestTypeSafeMiddleware: KituraTest {
respondWith(user, nil)
}
-
buildServerTest(router, timeout: 30)
.request("get", path: "/userMiddleware/1", headers: ["TestHeader": "Hello"])
.hasStatus(.OK)
@@ -242,13 +238,12 @@ class TestTypeSafeMiddleware: KituraTest {
func testMultipleMiddlewareGetIdentifier() {
// Expected user: User(id: 1, name: "Andy")
guard let user = userStore[1] else {
- print("no value found for userStore[1]")
- XCTFail()
+ XCTFail("no value found for userStore[1]")
return
}
router.get("/userMultiMiddleware") { (middleware: UserMiddleware, middleware2: UserMiddleware2, middleware3: UserMiddleware3, id: Int, respondWith: (User?, RequestError?) -> Void) in
- print("GET with identifier on /userMultiMiddleware - received headers \(middleware.header), \(middleware2.header), \(middleware3.header)")
+ print("GET with identifier: \(id) on /userMultiMiddleware - received headers \(middleware.header), \(middleware2.header), \(middleware3.header)")
respondWith(user, nil)
}
@@ -289,7 +284,6 @@ class TestTypeSafeMiddleware: KituraTest {
respondWith(intTuple, nil)
}
-
buildServerTest(router, timeout: 30)
.request("get", path: "/userMiddleware", headers: ["TestHeader": "Hello"])
.hasStatus(.OK)
@@ -340,12 +334,10 @@ class TestTypeSafeMiddleware: KituraTest {
.run()
}
-
func testSingleMiddlewareGetSingletonParameters() {
// Expected user: User(id: 1, name: "Andy")
guard let user = userStore[1] else {
- print("no value found for userStore[1]")
- XCTFail()
+ XCTFail("no value found for userStore[1]")
return
}
@@ -355,7 +347,6 @@ class TestTypeSafeMiddleware: KituraTest {
respondWith(user, nil)
}
-
buildServerTest(router, timeout: 30)
.request("get", path: "/userMiddleware?id=1", headers: ["TestHeader": "Hello"])
.hasStatus(.OK)
@@ -372,13 +363,12 @@ class TestTypeSafeMiddleware: KituraTest {
func testMultipleMiddlewareGetSingletonParameters() {
// Expected user: User(id: 1, name: "Andy")
guard let user = userStore[1] else {
- print("no value found for userStore[1]")
- XCTFail()
+ XCTFail("no value found for userStore[1]")
return
}
router.get("/userMultiMiddleware") { (middleware: UserMiddleware, middleware2: UserMiddleware2, middleware3: UserMiddleware3, query: MyQuery, respondWith: (User?, RequestError?) -> Void) in
- print("GET single with parameters on /userMultiMiddleware - received headers \(middleware.header), \(middleware2.header), \(middleware3.header)")
+ print("GET single with parameters: \(query) on /userMultiMiddleware - received headers \(middleware.header), \(middleware2.header), \(middleware3.header)")
respondWith(user, nil)
}
@@ -406,7 +396,6 @@ class TestTypeSafeMiddleware: KituraTest {
.run()
}
-
func testSingleMiddlewareGetArrayParameters() {
let userArray = [User(id: 1, name: "Andy"), User(id: 2, name: "Dave"), User(id: 3, name: "Ian")]
let expectedArray = [User(id: 1, name: "Andy"), User(id: 2, name: "Dave")]
@@ -417,7 +406,6 @@ class TestTypeSafeMiddleware: KituraTest {
respondWith(matchedUsers, nil)
}
-
buildServerTest(router, timeout: 30)
.request("get", path: "/userMiddleware?id=2", headers: ["TestHeader": "Hello"])
.hasStatus(.OK)
@@ -473,7 +461,6 @@ class TestTypeSafeMiddleware: KituraTest {
respondWith(nil)
}
-
buildServerTest(router, timeout: 30)
.request("delete", path: "/userMiddleware", headers: ["TestHeader": "Hello"])
.hasStatus(.noContent)
@@ -523,14 +510,13 @@ class TestTypeSafeMiddleware: KituraTest {
router.delete("/userMiddleware") { (middleware: UserMiddleware, id: Int, respondWith: (RequestError?) -> Void) in
print("DELETE on /userMiddleware - received header \(middleware.header)")
- guard let _ = self.userStore.removeValue(forKey: id) else {
+ guard self.userStore.removeValue(forKey: id) != nil else {
respondWith(.notFound)
return
}
respondWith(nil)
}
-
buildServerTest(router, timeout: 30)
.request("delete", path: "/userMiddleware/1", headers: ["TestHeader": "Hello"])
.hasStatus(.noContent)
@@ -548,7 +534,7 @@ class TestTypeSafeMiddleware: KituraTest {
router.delete("/userMultiMiddleware") { (middleware: UserMiddleware, middleware2: UserMiddleware2, middleware3: UserMiddleware3, id: Int, respondWith: (RequestError?) -> Void) in
print("DELETE on /userMultiMiddleware - received headers \(middleware.header), \(middleware2.header), \(middleware3.header)")
- guard let _ = self.userStore.removeValue(forKey: id) else {
+ guard self.userStore.removeValue(forKey: id) != nil else {
respondWith(.notFound)
return
}
@@ -566,7 +552,6 @@ class TestTypeSafeMiddleware: KituraTest {
.hasNoData()
.has { _ in XCTAssertNil(self.userStore[1]) }
-
// Test that Middleware2 fails when its header is missing, by examining the status (.notAcceptable)
.request("delete", path: "/userMultiMiddleware/1", headers: missing2ndHeader)
.hasStatus(.notAcceptable)
@@ -584,14 +569,13 @@ class TestTypeSafeMiddleware: KituraTest {
router.delete("/userMiddleware") { (middleware: UserMiddleware, query: MyQuery, respondWith: (RequestError?) -> Void) in
print("DELETE on /userMiddleware - received header \(middleware.header)")
- guard let _ = self.userStore.removeValue(forKey: query.id) else {
+ guard self.userStore.removeValue(forKey: query.id) != nil else {
respondWith(.notFound)
return
}
respondWith(nil)
}
-
buildServerTest(router, timeout: 30)
.request("delete", path: "/userMiddleware?id=1", headers: ["TestHeader": "Hello"])
.hasStatus(.noContent)
@@ -609,7 +593,7 @@ class TestTypeSafeMiddleware: KituraTest {
router.delete("/userMultiMiddleware") { (middleware: UserMiddleware, middleware2: UserMiddleware2, middleware3: UserMiddleware3, query: MyQuery, respondWith: (RequestError?) -> Void) in
print("DELETE on /userMultiMiddleware - received headers \(middleware.header), \(middleware2.header), \(middleware3.header)")
- guard let _ = self.userStore.removeValue(forKey: query.id) else {
+ guard self.userStore.removeValue(forKey: query.id) != nil else {
respondWith(.notFound)
return
}
@@ -627,7 +611,6 @@ class TestTypeSafeMiddleware: KituraTest {
.hasNoData()
.has { _ in XCTAssertNil(self.userStore[1]) }
-
// Test that Middleware2 fails when its header is missing, by examining the status (.notAcceptable)
.request("delete", path: "/userMultiMiddleware?id=1", headers: missing2ndHeader)
.hasStatus(.notAcceptable)
@@ -698,8 +681,7 @@ class TestTypeSafeMiddleware: KituraTest {
func testSingleMiddlewarePostIdentifier() {
// Expected user: User(id: 1, name: "Andy")
guard let user = userStore[1] else {
- print("no value found for userStore[1]")
- XCTFail()
+ XCTFail("no value found for userStore[1]")
return
}
@@ -726,8 +708,7 @@ class TestTypeSafeMiddleware: KituraTest {
func testMultipleMiddlewarePostIdentifier() {
// Expected user: User(id: 1, name: "Andy")
guard let user = userStore[1] else {
- print("no value found for userStore[1]")
- XCTFail()
+ XCTFail("no value found for userStore[1]")
return
}

fix: remove trailing Whitespace (#1283)