Skip to content

Commit

Permalink
Merge branch 'master' into fix/peer-exchange-interop-test
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 authored Jan 9, 2024
2 parents dca2f6e + 528803f commit ab29a15
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions packages/tests/tests/sharding/running_nodes.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { LightNode, ShardInfo, SingleShardInfo } from "@waku/interfaces";
import { createEncoder, createLightNode, utf8ToBytes } from "@waku/sdk";
import {
LightNode,
Protocols,
ShardInfo,
SingleShardInfo
} from "@waku/interfaces";
import {
createEncoder,
createLightNode,
utf8ToBytes,
waitForRemotePeer
} from "@waku/sdk";
import { singleShardInfoToPubsubTopic } from "@waku/utils";
import { expect } from "chai";

Expand Down Expand Up @@ -42,6 +52,8 @@ describe("Static Sharding: Running Nodes", () => {
waku = await createLightNode({
shardInfo: shardInfoBothShards
});
await waku.dial(await nwaku.getMultiaddrWithId());
await waitForRemotePeer(waku, [Protocols.LightPush]);

const encoder1 = createEncoder({
contentTopic: ContentTopic,
Expand All @@ -61,8 +73,8 @@ describe("Static Sharding: Running Nodes", () => {
payload: utf8ToBytes("Hello World")
});

expect(request1.recipients.length).to.eq(0);
expect(request2.recipients.length).to.eq(0);
expect(request1.recipients.length).to.eq(1);
expect(request2.recipients.length).to.eq(1);
});

it("using a protocol with unconfigured pubsub topic should fail", async function () {
Expand Down Expand Up @@ -119,6 +131,8 @@ describe("Autosharding: Running Nodes", () => {
contentTopics: [ContentTopic, ContentTopic2]
}
});
await waku.dial(await nwaku.getMultiaddrWithId());
await waitForRemotePeer(waku, [Protocols.LightPush]);

const encoder1 = createEncoder({
contentTopic: ContentTopic,
Expand All @@ -138,7 +152,7 @@ describe("Autosharding: Running Nodes", () => {
payload: utf8ToBytes("Hello World")
});

expect(request1.recipients.length).to.eq(0);
expect(request2.recipients.length).to.eq(0);
expect(request1.recipients.length).to.eq(1);
expect(request2.recipients.length).to.eq(1);
});
});

0 comments on commit ab29a15

Please sign in to comment.