 			XCTAssertNotEqual(handlers?.count, 0)
 			response.handlers = handlers
 			response.next()
-			
-			wait(for: [expect1], timeout: 10)
-			
+      		self.waitForExpectations(timeout: 10) { _ in }
+
 			XCTAssertEqual(response.header(.contentType), "application/json")
 			let decodeCheck = try? JSONDecoder().decode(Body.self, from: Data(bytes: response.bodyBytes))
 			XCTAssertNotNil(decodeCheck)
 		}
-		
+
+    	expect = expectation(description: "wait2")
+
 		do {
 			let request = ShimHTTPRequest()
 			let response = ShimHTTPResponse()

			response.handlers = handlers
			response.next()
			
			wait(for: [expect2], timeout: 10)
			
			XCTAssert(response.status.code == HTTPResponseStatus.badRequest.code)
		}
	}

	}
	
	func testTypedPromiseRoute() {
		var expect = expectation(description: "wait1")
		struct Body: Codable {
			let msg: String
		}
