UTF-8 test for NodeJS containers.
Re-enable UTF8 entity test (has been OK for a while).
diff --git a/tests/src/actionContainers/NodeJsActionContainerTests.scala b/tests/src/actionContainers/NodeJsActionContainerTests.scala
index dbbf4a0..46f38fe 100644
--- a/tests/src/actionContainers/NodeJsActionContainerTests.scala
+++ b/tests/src/actionContainers/NodeJsActionContainerTests.scala
@@ -630,11 +630,32 @@
val code = ZipBuilder.mkBase64Zip(srcs)
- val (out, err) = withNodeJsContainer { c =>
+ withNodeJsContainer { c =>
c.init(initPayload(code, main = "niam"))._1 should be(200)
val (runCode, runRes) = c.run(runPayload(JsObject()))
runRes.get.fields.get("result") shouldBe Some(JsString("it works"))
}
}
+
+ it should "handle unicode in source, input params, logs, and result" in {
+ val (out, err) = withNodeJsContainer { c =>
+ val code = """
+ | function main(args) {
+ | var str = args.delimiter + " ☃ " + args.delimiter;
+ | console.log(str);
+ | return { "winter": str };
+ | }
+ """.stripMargin
+
+ c.init(initPayload(code))._1 should be(200)
+ val (runCode, runRes) = c.run(runPayload(JsObject("delimiter" -> JsString("❄"))))
+ runRes.get.fields.get("winter") shouldBe Some(JsString("❄ ☃ ❄"))
+ }
+
+ checkStreams(out, err, {
+ case (o, _) =>
+ o.toLowerCase should include("❄ ☃ ❄")
+ })
+ }
}
diff --git a/tests/src/system/basic/WskBasicNodeTests.scala b/tests/src/system/basic/WskBasicNodeTests.scala
index 9225584..0a85ab7 100644
--- a/tests/src/system/basic/WskBasicNodeTests.scala
+++ b/tests/src/system/basic/WskBasicNodeTests.scala
@@ -147,6 +147,25 @@
}
}
+ it should "Ensure that UTF-8 in supported in source files, input params, logs, and output results" in withAssetCleaner(wskprops) {
+ (wp, assetHelper) =>
+ val name = "unicodeGalore"
+
+ assetHelper.withCleaner(wsk.action, name) {
+ (action, _) =>
+ action.create(name, Some(TestUtils.getTestActionFilename("unicode.js")))
+ }
+
+ withActivation(wsk.activation, wsk.action.invoke(name, parameters = Map("delimiter" -> JsString("❄")))) {
+ activation =>
+ val response = activation.response
+ response.result.get.fields.get("error") shouldBe empty
+ response.result.get.fields.get("winter") should be(Some(JsString("❄ ☃ ❄")))
+
+ activation.logs.toList.flatten.mkString(" ") should include("❄ ☃ ❄")
+ }
+ }
+
// TODO: remove this tests and its assets when "whisk.js" is removed entirely as it is no longer necessary
it should "Ensure that whisk.invoke() returns a promise" in withAssetCleaner(wskprops) {
val expectedDuration = 3.seconds
diff --git a/tests/src/whisk/core/entity/test/DatastoreTests.scala b/tests/src/whisk/core/entity/test/DatastoreTests.scala
index 5f40794..d5a419d 100644
--- a/tests/src/whisk/core/entity/test/DatastoreTests.scala
+++ b/tests/src/whisk/core/entity/test/DatastoreTests.scala
@@ -141,7 +141,7 @@
}
}
- ignore should "CRD activation with utf8 characters" in {
+ it should "CRD activation with utf8 characters" in {
implicit val tid = transid()
implicit val basename = EntityName("create action blackbox")
val activations = Seq(