Skip to content
This repository was archived by the owner on Jul 14, 2020. It is now read-only.

Moved .forTesting() functions to new importable LambdaRuntimeTestUtils target #20

Merged
merged 5 commits into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ let package = Package(
name: "LambdaRuntime",
dependencies: ["AsyncHTTPClient", "NIO", "NIOHTTP1", "NIOFoundationCompat", "Logging", "Base64Kit"]
),
.testTarget(name: "LambdaRuntimeTests", dependencies: ["LambdaRuntime", "NIOTestUtils", "Logging"])
.target(
name: "LambdaRuntimeTestUtils",
dependencies: ["NIOHTTP1", "LambdaRuntime"]
),
.testTarget(name: "LambdaRuntimeTests", dependencies: ["LambdaRuntime", "NIOTestUtils", "Logging", "LambdaRuntimeTestUtils"])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code beauty:

.testTarget(name: "LambdaRuntimeTests", dependencies: [
  "LambdaRuntime", 
  "LambdaRuntimeTestUtils",
  "NIOTestUtils", 
  "Logging", 
])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair!

]
)
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import NIO
import NIOHTTP1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIOHTTP1 can be removed here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course! Done.

@testable import LambdaRuntime

extension Environment {

static func forTesting(
public static func forTesting(
lambdaRuntimeAPI: String? = nil,
handler : String? = nil,
functionName : String? = nil,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import Foundation
import NIO
import NIOHTTP1
@testable import LambdaRuntime

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove NIO here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!!

extension Invocation {

static func forTesting(
public static func forTesting(
requestId : String = UUID().uuidString.lowercased(),
timeout : TimeInterval = 1,
functionArn: String = "arn:aws:lambda:us-east-1:123456789012:function:custom-runtime",
Expand Down
1 change: 1 addition & 0 deletions Tests/LambdaRuntimeTests/ContextTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation
import XCTest
import NIO
import LambdaRuntimeTestUtils
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put below (3 times)

@testable import LambdaRuntime

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@testable import LambdaRuntime

class ContextTests: XCTestCase {
Expand Down
1 change: 1 addition & 0 deletions Tests/LambdaRuntimeTests/Events/APIGatewayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import XCTest
import NIO
import NIOHTTP1
import NIOFoundationCompat
import LambdaRuntimeTestUtils
@testable import LambdaRuntime

class APIGatewayTests: XCTestCase {
Expand Down
1 change: 1 addition & 0 deletions Tests/LambdaRuntimeTests/Runtime+CodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation
import XCTest
import NIO
import NIOHTTP1
import LambdaRuntimeTestUtils
@testable import LambdaRuntime

class RuntimeCodableTests: XCTestCase {
Expand Down