update test

This commit is contained in:
DieMyst
2021-06-07 18:17:01 +03:00
parent 257ef0ce68
commit 42304a2bd3
4 changed files with 16 additions and 10 deletions

View File

@ -2,9 +2,12 @@ data Prod:
value: string
service OpHa("op"):
array(a: string, b: string) -> []string
identity(a: string) -> string
func doSmth(arg: Prod) -> string:
func doSmth(arg: Prod) -> []string:
v = arg.value
a <- OpHa.identity(v)
<- a
b = "hello"
res <- OpHa.array(a, b)
<- res

View File

@ -12,9 +12,9 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
export async function doSmth(client: FluenceClient, arg: {value:string}): Promise<string> {
export async function doSmth(client: FluenceClient, arg: {value:string}): Promise<string[]> {
let request: RequestFlow;
const promise = new Promise<string>((resolve, reject) => {
const promise = new Promise<string[]>((resolve, reject) => {
request = new RequestFlowBuilder()
.disableInjections()
.withRawScript(
@ -23,13 +23,16 @@ export async function doSmth(client: FluenceClient, arg: {value:string}): Promis
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "arg") [] arg)
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "arg") [] arg)
)
(call %init_peer_id% ("op" "identity") [arg.$.value!] a)
)
(call %init_peer_id% ("op" "identity") [arg.$.value!] a)
(call %init_peer_id% ("op" "array") [a "hello"] res)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [a])
(call %init_peer_id% ("callbackSrv" "response") [res])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)

View File

@ -2,6 +2,6 @@ import {FluenceClient} from "@fluencelabs/fluence";
import {passFunctionAsArg} from "../compiled/examples/callArrow";
import {doSmth} from "../compiled/examples/assignment";
export async function assignmentCall(client: FluenceClient): Promise<string> {
export async function assignmentCall(client: FluenceClient): Promise<string[]> {
return await doSmth(client, {value: "abc"})
}

View File

@ -145,7 +145,7 @@ const main = async () => {
checkCall("nestedFuncsCall", nestedFuncsResult, "some-str", cb)
checkCall("assignmentCall", assignmentResult, "abc", cb)
checkCall("assignmentCall", assignmentResult, ["abc", "hello"], cb)
if (success) {
process.exit(0)