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

Commit 4d5bf60

Browse files
mr-j-treefabianfett
authored andcommitted
Moved .forTesting() functions to new importable LambdaRuntimeTestUtils target (#20)
* Created new importable LambdaRuntimeTestUtils target for Environment.forTesting() and other testing utility code. * Moved Invocation.forTesting() to the LambdaRuntimeTestUtils target. * Removed unnecessary dependencies in LambdaRuntimeTestUtils target * Removed NIO imports in LambdaRuntimeTestUtils source files * Tweaks to imports and code style.
1 parent 36bf21e commit 4d5bf60

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

Package.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ let package = Package(
2222
name: "LambdaRuntime",
2323
dependencies: ["AsyncHTTPClient", "NIO", "NIOHTTP1", "NIOFoundationCompat", "Logging", "Base64Kit"]
2424
),
25-
.testTarget(name: "LambdaRuntimeTests", dependencies: ["LambdaRuntime", "NIOTestUtils", "Logging"])
25+
.target(
26+
name: "LambdaRuntimeTestUtils",
27+
dependencies: ["NIOHTTP1", "LambdaRuntime"]
28+
),
29+
.testTarget(name: "LambdaRuntimeTests", dependencies: [
30+
"LambdaRuntime",
31+
"LambdaRuntimeTestUtils",
32+
"NIOTestUtils",
33+
"Logging",
34+
])
2635
]
2736
)

Tests/LambdaRuntimeTests/Utils/Environment+TestUtils.swift renamed to Sources/LambdaRuntimeTestUtils/Environment+TestUtils.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import NIO
2-
import NIOHTTP1
31
@testable import LambdaRuntime
42

53
extension Environment {
64

7-
static func forTesting(
5+
public static func forTesting(
86
lambdaRuntimeAPI: String? = nil,
97
handler : String? = nil,
108
functionName : String? = nil,

Tests/LambdaRuntimeTests/Utils/Invocation+TestUtils.swift renamed to Sources/LambdaRuntimeTestUtils/Invocation+TestUtils.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import Foundation
2-
import NIO
32
import NIOHTTP1
43
@testable import LambdaRuntime
54

65
extension Invocation {
76

8-
static func forTesting(
7+
public static func forTesting(
98
requestId : String = UUID().uuidString.lowercased(),
109
timeout : TimeInterval = 1,
1110
functionArn: String = "arn:aws:lambda:us-east-1:123456789012:function:custom-runtime",

Tests/LambdaRuntimeTests/ContextTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Foundation
22
import XCTest
33
import NIO
44
@testable import LambdaRuntime
5+
import LambdaRuntimeTestUtils
56

67
class ContextTests: XCTestCase {
78

Tests/LambdaRuntimeTests/Events/APIGatewayTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import XCTest
33
import NIO
44
import NIOHTTP1
55
import NIOFoundationCompat
6+
import LambdaRuntimeTestUtils
67
@testable import LambdaRuntime
78

89
class APIGatewayTests: XCTestCase {

Tests/LambdaRuntimeTests/Runtime+CodableTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Foundation
22
import XCTest
33
import NIO
44
import NIOHTTP1
5+
import LambdaRuntimeTestUtils
56
@testable import LambdaRuntime
67

78
class RuntimeCodableTests: XCTestCase {

0 commit comments

Comments
 (0)