mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-03-16 09:33:18 +00:00
fix: non duplicacy should happen in application-specific scenario
This commit is contained in:
parent
b7c60a2332
commit
1932ef5fdc
@ -118,7 +118,14 @@ export class ServiceNodesFleet {
|
||||
}
|
||||
): Promise<void> {
|
||||
if (encryptedPayload) {
|
||||
expect(this.messageCollector.count).to.equal(numMessages);
|
||||
const filteredMessageList = Array.from(
|
||||
new Set(
|
||||
this.messageCollector.messageList
|
||||
.filter((msg) => msg.payload?.toString)
|
||||
.map((msg) => msg.payload.toString())
|
||||
)
|
||||
);
|
||||
expect(filteredMessageList.length).to.equal(numMessages);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -146,7 +153,7 @@ export class ServiceNodesFleet {
|
||||
|
||||
class MultipleNodesMessageCollector {
|
||||
public callback: (msg: DecodedMessage) => void = () => {};
|
||||
protected messageList: Array<DecodedMessage> = [];
|
||||
public readonly messageList: Array<DecodedMessage> = [];
|
||||
public constructor(
|
||||
private messageCollectors: MessageCollector[],
|
||||
private relayNodes?: ServiceNode[],
|
||||
@ -154,14 +161,7 @@ class MultipleNodesMessageCollector {
|
||||
) {
|
||||
this.callback = (msg: DecodedMessage): void => {
|
||||
log.info("Got a message");
|
||||
// Only add message if we haven't seen it before
|
||||
if (
|
||||
!this.messageList.find(
|
||||
(m) => m.payload.toString() === msg.payload.toString()
|
||||
)
|
||||
) {
|
||||
this.messageList.push(msg);
|
||||
}
|
||||
this.messageList.push(msg);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ const runTests = (strictCheckNodes: boolean): void => {
|
||||
expectedPubsubTopic: TestPubsubTopic
|
||||
});
|
||||
|
||||
await serviceNodes.confirmMessageLength(1);
|
||||
await serviceNodes.confirmMessageLength(1, { encryptedPayload: true });
|
||||
});
|
||||
|
||||
it("Subscribe and receive messages via waku relay post", async function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user