-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from heaven-born/master
- Loading branch information
Showing
2 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
lambda/src/test/scala/zio/lambda/internal/RuntimeApiLiveSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package zio.lambda.internal | ||
|
||
import zio._ | ||
import zio.test.Assertion._ | ||
import zio.test._ | ||
|
||
import java.net.{ConnectException, ServerSocket} | ||
|
||
object RuntimeApiLiveSpec extends ZIOSpecDefault { | ||
|
||
val serverSocket = new ServerSocket(8085) | ||
|
||
override def spec = | ||
suite("RuntimeApiLiveSpec spec")( | ||
test("sendInvocationResponse should not throw any error when unicode string is provided") { | ||
|
||
check(Gen.string(Gen.unicodeChar)) { unicodeString => | ||
val env = LambdaEnvironment("localhost:8085", "", "", 0, "", "", "", "") | ||
val resp = InvocationResponse("id", unicodeString) | ||
val runtime = new RuntimeApiLive(env) | ||
for { | ||
_ <- ZIO.attempt { | ||
serverSocket.accept().close() | ||
}.fork | ||
res <- runtime.sendInvocationResponse(resp).retryWhile(_.isInstanceOf[ConnectException]) | ||
} yield assert(res)(isUnit) | ||
} | ||
|
||
} | ||
) | ||
|
||
} |