Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ningyougang committed Jul 25, 2022
1 parent 0aff198 commit ccfe651
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class ActionProxyContainerTests extends BasicActionRunnerTests with WskActorSyst
initCode should be(200)
val (runCode, out) = c.run(JsNull)
runCode should be(502)
out should be(Some(JsObject("error" -> JsString("The action did not return a dictionary."))))
out should be(Some(JsObject("error" -> JsString("The action did not return a dictionary or array."))))
}

checkStreams(out, err, {
Expand Down Expand Up @@ -270,4 +270,20 @@ class ActionProxyContainerTests extends BasicActionRunnerTests with WskActorSyst
runRes.get.fields.get("pwd_cmd") shouldBe Some(JsString("/action"))
}
}

it should "support array result" in {
withActionContainer() { c =>
val code = """
|#!/bin/bash
|echo '["a", "b"]'
""".stripMargin.trim

val (initCode, initRes) = c.init(initPayload(code))
initCode should be(200)

val (runCode, runRes) = c.runForJsArray(JsObject())
runCode should be(200)
runRes shouldBe Some(JsArray(JsString("a"), JsString("b")))
}
}
}

0 comments on commit ccfe651

Please sign in to comment.