mirror of
https://github.com/waku-org/js-waku.git
synced 2025-02-21 08:38:17 +00:00
fix: return early if expect passes
This commit is contained in:
parent
a8e338f985
commit
9127637151
@ -119,6 +119,7 @@ export class ServiceNodesFleet {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (encryptedPayload) {
|
if (encryptedPayload) {
|
||||||
expect(this.messageCollector.count).to.equal(numMessages);
|
expect(this.messageCollector.count).to.equal(numMessages);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.strictChecking) {
|
if (this.strictChecking) {
|
||||||
@ -153,13 +154,14 @@ class MultipleNodesMessageCollector {
|
|||||||
) {
|
) {
|
||||||
this.callback = (msg: DecodedMessage): void => {
|
this.callback = (msg: DecodedMessage): void => {
|
||||||
log.info("Got a message");
|
log.info("Got a message");
|
||||||
|
// Only add message if we haven't seen it before
|
||||||
if (
|
if (
|
||||||
this.messageList.find(
|
!this.messageList.find(
|
||||||
(m) => m.payload.toString() === msg.payload.toString()
|
(m) => m.payload.toString() === msg.payload.toString()
|
||||||
)
|
)
|
||||||
)
|
) {
|
||||||
return;
|
this.messageList.push(msg);
|
||||||
this.messageList.push(msg);
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user