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 all 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
11 changes: 10 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ 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",
"LambdaRuntimeTestUtils",
"NIOTestUtils",
"Logging",
])
]
)
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import NIO
import NIOHTTP1
@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
Expand Up @@ -2,6 +2,7 @@ import Foundation
import XCTest
import NIO
@testable import LambdaRuntime
import LambdaRuntimeTestUtils

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