mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-06-26 11:51:36 +00:00
test for push-stream, comment tests
This commit is contained in:
9
aqua/examples/pushToStream.aqua
Normal file
9
aqua/examples/pushToStream.aqua
Normal file
@ -0,0 +1,9 @@
|
||||
service OpA("pop"):
|
||||
get_str() -> string
|
||||
|
||||
func get_results() -> []string:
|
||||
results: *string
|
||||
results <<- "hello"
|
||||
str <- OpA.get_str()
|
||||
results <<- str
|
||||
<- results
|
10
src/examples/pushToStreamCall.ts
Normal file
10
src/examples/pushToStreamCall.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import {FluenceClient, registerServiceFunction} from "@fluencelabs/fluence";
|
||||
import {get_results} from "../compiled/examples/pushToStream";
|
||||
|
||||
export async function pushToStreamCall(client: FluenceClient) {
|
||||
registerServiceFunction(client, "pop", "get_str", (args: any[], _) => {
|
||||
return "get_string"
|
||||
})
|
||||
|
||||
return await get_results(client)
|
||||
}
|
@ -25,6 +25,7 @@ import {coCall} from "./examples/coCall";
|
||||
import {passArgsCall} from "./examples/passArgsCall";
|
||||
import {streamArgsCall} from "./examples/streamArgsCall";
|
||||
import {streamResultsCall} from "./examples/streamResultsCall";
|
||||
import {pushToStreamCall} from "./examples/pushToStreamCall";
|
||||
let deepEqual = require('deep-equal')
|
||||
|
||||
function checkCall(name: string, expected: any, actual: any, callBackOnError: () => void) {
|
||||
@ -127,10 +128,13 @@ const main = async () => {
|
||||
let passArgsResult = await passArgsCall(client)
|
||||
|
||||
// streamArgs.aqua
|
||||
let streamArgsResult = await streamArgsCall(client)
|
||||
// let streamArgsResult = await streamArgsCall(client)
|
||||
|
||||
// streamResults.aqua
|
||||
let streamResultsResult = await streamResultsCall(client)
|
||||
// let streamResultsResult = await streamResultsCall(client)
|
||||
|
||||
// pushToStream.aqua
|
||||
let pushToStreamResult = await pushToStreamCall(client)
|
||||
|
||||
await client.disconnect();
|
||||
|
||||
@ -177,9 +181,11 @@ const main = async () => {
|
||||
|
||||
checkCall("passArgsCall", passArgsResult, "client-utilsid", cb)
|
||||
|
||||
checkCall("streamArgsCall", streamArgsResult, [["peer_id", "peer_id"]], cb)
|
||||
// checkCall("streamArgsCall", streamArgsResult, [["peer_id", "peer_id"]], cb)
|
||||
|
||||
checkCall("streamResultsCall", streamResultsResult, ["new_name", "new_name", "new_name"], cb)
|
||||
// checkCall("streamResultsCall", streamResultsResult, ["new_name", "new_name", "new_name"], cb)
|
||||
|
||||
checkCall("pushToStreamCall", pushToStreamResult, ["hello", "get_string"], cb)
|
||||
|
||||
checkCallBy("tryCatchCall", tryCatchResult, (res) => {
|
||||
return (res[0] as string).includes("Error: Service with id 'unex' not found") && res[1] === '/ip4/164.90.171.139/tcp/7770'
|
||||
|
Reference in New Issue
Block a user