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

Conversation

mr-j-tree
Copy link
Contributor

By moving Environment.forTesting() and Invocation.forTesting() to a new build target, these functions can now be used in your own unit tests when developing Lambda functions in Swift.

Copy link
Owner

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

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

This is awesome. Thanks so much for contributing. Only small nits, to please my style of coding - that I haven't documented anywhere.

@@ -5,7 +5,7 @@ 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.

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!!!

Package.swift Outdated
.testTarget(name: "LambdaRuntimeTests", dependencies: ["LambdaRuntime", "NIOTestUtils", "Logging"])
.target(
name: "LambdaRuntimeTestUtils",
dependencies: ["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 need to add NIOHTTP1 here, since we use HTTPHeaders

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!!

Package.swift Outdated
name: "LambdaRuntimeTestUtils",
dependencies: ["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!

@@ -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.

👍🏻

@@ -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.

Copy link
Contributor Author

@mr-j-tree mr-j-tree left a comment

Choose a reason for hiding this comment

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

All requested changes have been made. Thanks @fabianfett !!!

@fabianfett fabianfett added this to the v0.4.0 milestone Jan 13, 2020
@fabianfett fabianfett merged commit 4d5bf60 into fabianfett:master Jan 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants