Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
InversionSpaces committed Oct 16, 2023
1 parent ff9fa7a commit da57f04
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
25 changes: 24 additions & 1 deletion integration-tests/aqua/examples/topology.aqua
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
aqua Toplogy

export Testo, LocalPrint, topologyTest, topologyBug205, topologyBug394, topologyBug427, topologyBug257

import "@fluencelabs/aqua-lib/builtin.aqua"

service Testo("testo"):
Expand Down Expand Up @@ -50,4 +54,23 @@ func topologyBug427(peers: []string) -> []string:
results <- Opop.identity("some string")

join results[1]
<- results
<- results

service StrOp("op"):
identity(str: string) -> string

func idOnPeer(friend: string, friendRelay: string, str: string) -> string:
on friend via friendRelay:
result <- StrOp.identity(str)

<- result

func topologyBug257(friend: string, friendRelay: string) -> []string:
result: *string

on HOST_PEER_ID:
result <- StrOp.identity("host")
result <- idOnPeer(friend, friendRelay, "friend")
result <- idOnPeer(INIT_PEER_ID, HOST_PEER_ID, "init")

<- result
6 changes: 6 additions & 0 deletions integration-tests/src/__test__/examples.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
topologyBug205Call,
topologyBug394Call,
topologyBug427Call,
topologyBug257Call,
topologyCall,
} from "../examples/topologyCall.js";
import { foldJoinCall } from "../examples/foldJoinCall.js";
Expand Down Expand Up @@ -896,6 +897,11 @@ describe("Testing examples", () => {
expect(topologyResult).toEqual(selfPeerId);
});

it("topology.aqua bug 257", async () => {
let result = await topologyBug257Call(peer2);
expect(result).toEqual(["host", "friend", "init"]);
});

it("foldJoin.aqua", async () => {
let foldJoinResult = await foldJoinCall(relayPeerId1);
expect(foldJoinResult.length).toBeGreaterThanOrEqual(3);
Expand Down
7 changes: 7 additions & 0 deletions integration-tests/src/examples/topologyCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
topologyBug205,
topologyBug394,
topologyBug427,
topologyBug257,
} from "../compiled/examples/topology.js";

export async function topologyBug394Call(
Expand Down Expand Up @@ -66,3 +67,9 @@ export async function topologyCall(
},
);
}

export async function topologyBug257Call(
peer2: IFluenceClient,
): Promise<string[]> {
return await topologyBug257(peer2.getPeerId(), peer2.getRelayPeerId());
}

0 comments on commit da57f04

Please sign in to comment.