mirror of https://github.com/waku-org/js-waku.git
fix(tests): floating promises
This commit is contained in:
parent
8f652bfb8d
commit
f2d64c80ac
|
@ -103,21 +103,18 @@ export class ServiceNodesFleet {
|
|||
pubsubTopic?: string,
|
||||
raw = false
|
||||
): Promise<boolean> {
|
||||
let relayMessagePromises: Promise<boolean>[];
|
||||
if (raw) {
|
||||
relayMessagePromises = this.nodes.map((node) =>
|
||||
node.rpcCall<boolean>("post_waku_v2_relay_v1_message", [
|
||||
pubsubTopic && pubsubTopic,
|
||||
const relayMessagePromises = this.nodes.map((node) => {
|
||||
if (raw) {
|
||||
return node.rpcCall<boolean>("post_waku_v2_relay_v1_message", [
|
||||
pubsubTopic ?? pubsubTopic,
|
||||
message
|
||||
])
|
||||
);
|
||||
} else {
|
||||
relayMessagePromises = this.nodes.map((node) =>
|
||||
node.sendMessage(message, pubsubTopic)
|
||||
);
|
||||
}
|
||||
]);
|
||||
}
|
||||
return node.sendMessage(message, pubsubTopic);
|
||||
});
|
||||
|
||||
const relayMessages = await Promise.all(relayMessagePromises);
|
||||
return relayMessages.every((message) => message);
|
||||
return relayMessages.every(Boolean); // More concise way to check all true
|
||||
}
|
||||
|
||||
async confirmMessageLength(numMessages: number): Promise<void> {
|
||||
|
|
|
@ -191,7 +191,7 @@ describe("Waku Store, cursor", function () {
|
|||
for await (const page of waku.store.queryGenerator([TestDecoder], {
|
||||
cursor
|
||||
})) {
|
||||
page;
|
||||
void page;
|
||||
}
|
||||
throw new Error("Cursor with wrong pubsubtopic was accepted");
|
||||
} catch (err) {
|
||||
|
|
|
@ -39,7 +39,7 @@ describe("Waku Store, error handling", function () {
|
|||
for await (const msgPromises of waku.store.queryGenerator([
|
||||
customDecoder1
|
||||
])) {
|
||||
msgPromises;
|
||||
void msgPromises;
|
||||
}
|
||||
throw new Error("QueryGenerator was successful but was expected to fail");
|
||||
} catch (err) {
|
||||
|
@ -60,7 +60,7 @@ describe("Waku Store, error handling", function () {
|
|||
TestDecoder,
|
||||
customDecoder1
|
||||
])) {
|
||||
msgPromises;
|
||||
void msgPromises;
|
||||
}
|
||||
throw new Error("QueryGenerator was successful but was expected to fail");
|
||||
} catch (err) {
|
||||
|
@ -78,7 +78,7 @@ describe("Waku Store, error handling", function () {
|
|||
it("Query Generator, No Decoder", async function () {
|
||||
try {
|
||||
for await (const msgPromises of waku.store.queryGenerator([])) {
|
||||
msgPromises;
|
||||
void msgPromises;
|
||||
}
|
||||
throw new Error("QueryGenerator was successful but was expected to fail");
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue