mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-13 21:43:07 +00:00
* new lightpush tests * fixes after CI run * split tests into 2 files * small fix * address code review comments * small fix after CI run --------- Co-authored-by: Danish Arora <35004822+danisharora099@users.noreply.github.com>
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { LightNode } from "@waku/interfaces";
|
|
import { utf8ToBytes } from "@waku/utils/bytes";
|
|
import { expect } from "chai";
|
|
|
|
import { MessageCollector, NimGoNode, tearDownNodes } from "../../src/index.js";
|
|
|
|
import {
|
|
messageText,
|
|
runNodes,
|
|
TestContentTopic,
|
|
TestEncoder
|
|
} from "./utils.js";
|
|
|
|
describe("Waku Light Push [node only] - custom pubsub topic", function () {
|
|
this.timeout(15000);
|
|
let waku: LightNode;
|
|
let nwaku: NimGoNode;
|
|
let messageCollector: MessageCollector;
|
|
const customPubSubTopic = "/waku/2/custom-dapp/proto";
|
|
|
|
beforeEach(async function () {
|
|
[nwaku, waku] = await runNodes(this, customPubSubTopic);
|
|
messageCollector = new MessageCollector(
|
|
TestContentTopic,
|
|
nwaku,
|
|
customPubSubTopic
|
|
);
|
|
});
|
|
|
|
this.afterEach(async function () {
|
|
tearDownNodes([nwaku], [waku]);
|
|
});
|
|
|
|
it("Push message", async function () {
|
|
const nimPeerId = await nwaku.getPeerId();
|
|
|
|
const pushResponse = await waku.lightPush.send(TestEncoder, {
|
|
payload: utf8ToBytes(messageText)
|
|
});
|
|
|
|
expect(pushResponse.recipients[0].toString()).to.eq(nimPeerId.toString());
|
|
|
|
expect(await messageCollector.waitForMessages(1)).to.eq(true);
|
|
messageCollector.verifyReceivedMessage(0, {
|
|
expectedMessageText: messageText,
|
|
expectedContentTopic: TestContentTopic
|
|
});
|
|
});
|
|
});
|