test: Ensure pubsub topic is used when sending and retrieving messages

This commit is contained in:
Franck Royer 2022-06-15 11:12:06 +10:00 committed by fryorcraken.eth
parent 4a96472084
commit 953bda781f
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 5 additions and 2 deletions

View File

@ -82,6 +82,7 @@ describe("Waku Light Push [node only]", () => {
dbg("Send message via lightpush");
const pushResponse = await waku.lightPush.push(message, {
peerId: nimPeerId,
pubSubTopic: customPubSubTopic,
});
dbg("Ack received", pushResponse);
expect(pushResponse?.isSuccess).to.be.true;

View File

@ -217,7 +217,9 @@ export class Nwaku {
]);
}
async messages(pubsubTopic?: string): Promise<WakuMessage[]> {
async messages(
pubsubTopic: string = DefaultPubSubTopic
): Promise<WakuMessage[]> {
this.checkProcess();
const isDefined = (msg: WakuMessage | undefined): msg is WakuMessage => {
@ -226,7 +228,7 @@ export class Nwaku {
const protoMsgs = await this.rpcCall<proto.WakuMessage[]>(
"get_waku_v2_relay_v1_messages",
[pubsubTopic ?? DefaultPubSubTopic]
[pubsubTopic]
);
const msgs = await Promise.all(