mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-06-22 05:51:49 +00:00
update test
This commit is contained in:
@ -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
|
@ -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])
|
||||
)
|
||||
)
|
||||
|
@ -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"})
|
||||
}
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user