Florin Barbu 1ec0c200ca
chore: new relay tests (#1649)
* make relay folder

* make relay folder

* adjust message collector for relay

* small fix

* small fix

* small fix

* split tests more

* small fixes

* small fix

* new test

* fix pubsubtopic name

* new subscribe tests

* new subscribe tests

* new tests

* small fix after ci run

* small fix after ci run2

* fix skipped test

* added issue for skipped test
2023-10-23 18:08:33 +03:00

30 lines
1019 B
TypeScript

import { createDecoder, createEncoder, waitForRemotePeer } from "@waku/core";
import { Protocols, RelayNode } from "@waku/interfaces";
import { Logger } from "@waku/utils";
export const messageText = "Relay works!";
export const TestContentTopic = "/test/1/waku-relay/utf8";
export const TestEncoder = createEncoder({ contentTopic: TestContentTopic });
export const TestDecoder = createDecoder(TestContentTopic);
export const CustomContentTopic = "/test/2/waku-relay/utf8";
export const CustomPubSubTopic = "/some/pubsub/topic";
export const CustomEncoder = createEncoder({
contentTopic: CustomContentTopic,
pubsubTopic: CustomPubSubTopic
});
export const CustomDecoder = createDecoder(
CustomContentTopic,
CustomPubSubTopic
);
export const log = new Logger("test:relay");
export async function waitForAllRemotePeers(
...nodes: RelayNode[]
): Promise<void> {
log.info("Wait for mutual pubsub subscription");
await Promise.all(
nodes.map((node) => waitForRemotePeer(node, [Protocols.Relay]))
);
}