stream as argument in callback test

This commit is contained in:
DieMyst
2021-11-01 12:20:08 +03:00
parent 0c29c1fb7a
commit 80d46cc4a8
3 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
module Ret declares *
export someFunc
func someFunc(cb: []string -> ()):
ifaces: *string
cb(ifaces)

View File

@@ -33,6 +33,7 @@ import { relays } from '../config';
import {closuresCall} from "../examples/closures";
import {topologyBug205} from "../compiled/examples/topology";
import {streamCanCall} from "../examples/streamCan";
import {streamCallbackCall} from "../examples/streamCallback";
var selfPeerId: string;
var peer2: FluencePeer;
@@ -139,6 +140,11 @@ describe('Testing examples', () => {
expect(streamCanResult).toStrictEqual([["a"], ["b"], []]);
});
it('streamCallback.aqua', async () => {
let streamCallResult = await streamCallbackCall();
expect(streamCallResult).toStrictEqual([]);
});
it('topology.aqua', async () => {
let topologyResult = await topologyCall(peer2);
expect(topologyResult).toBe('finish');

View File

@@ -0,0 +1,9 @@
import {someFunc} from "../compiled/examples/streamCallback";
export async function streamCallbackCall(): Promise<string[]> {
return new Promise<string[]>((resolve, reject) => {
someFunc((a: string[]) => {
resolve(a);
})
});
}