diff --git a/Package.swift b/Package.swift index 531495c..46de06d 100644 --- a/Package.swift +++ b/Package.swift @@ -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", + ]) ] ) diff --git a/Tests/LambdaRuntimeTests/Utils/Environment+TestUtils.swift b/Sources/LambdaRuntimeTestUtils/Environment+TestUtils.swift similarity index 96% rename from Tests/LambdaRuntimeTests/Utils/Environment+TestUtils.swift rename to Sources/LambdaRuntimeTestUtils/Environment+TestUtils.swift index 35f430a..a68ebcf 100644 --- a/Tests/LambdaRuntimeTests/Utils/Environment+TestUtils.swift +++ b/Sources/LambdaRuntimeTestUtils/Environment+TestUtils.swift @@ -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, diff --git a/Tests/LambdaRuntimeTests/Utils/Invocation+TestUtils.swift b/Sources/LambdaRuntimeTestUtils/Invocation+TestUtils.swift similarity index 95% rename from Tests/LambdaRuntimeTests/Utils/Invocation+TestUtils.swift rename to Sources/LambdaRuntimeTestUtils/Invocation+TestUtils.swift index b965b40..25b0b3a 100644 --- a/Tests/LambdaRuntimeTests/Utils/Invocation+TestUtils.swift +++ b/Sources/LambdaRuntimeTestUtils/Invocation+TestUtils.swift @@ -1,11 +1,10 @@ import Foundation -import NIO import NIOHTTP1 @testable import LambdaRuntime 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", diff --git a/Tests/LambdaRuntimeTests/ContextTests.swift b/Tests/LambdaRuntimeTests/ContextTests.swift index 7aedfb4..ed72b13 100644 --- a/Tests/LambdaRuntimeTests/ContextTests.swift +++ b/Tests/LambdaRuntimeTests/ContextTests.swift @@ -2,6 +2,7 @@ import Foundation import XCTest import NIO @testable import LambdaRuntime +import LambdaRuntimeTestUtils class ContextTests: XCTestCase { diff --git a/Tests/LambdaRuntimeTests/Events/APIGatewayTests.swift b/Tests/LambdaRuntimeTests/Events/APIGatewayTests.swift index 96db4c8..e8fd769 100644 --- a/Tests/LambdaRuntimeTests/Events/APIGatewayTests.swift +++ b/Tests/LambdaRuntimeTests/Events/APIGatewayTests.swift @@ -3,6 +3,7 @@ import XCTest import NIO import NIOHTTP1 import NIOFoundationCompat +import LambdaRuntimeTestUtils @testable import LambdaRuntime class APIGatewayTests: XCTestCase { diff --git a/Tests/LambdaRuntimeTests/Runtime+CodableTests.swift b/Tests/LambdaRuntimeTests/Runtime+CodableTests.swift index 2a07e6b..4406409 100644 --- a/Tests/LambdaRuntimeTests/Runtime+CodableTests.swift +++ b/Tests/LambdaRuntimeTests/Runtime+CodableTests.swift @@ -2,6 +2,7 @@ import Foundation import XCTest import NIO import NIOHTTP1 +import LambdaRuntimeTestUtils @testable import LambdaRuntime class RuntimeCodableTests: XCTestCase {