mirror of https://github.com/waku-org/js-waku.git
Use waitForRemotePeer directly
This commit is contained in:
parent
9b6fd5ec8b
commit
e8e6df767b
|
@ -7,7 +7,6 @@ import {
|
||||||
NOISE_KEY_2,
|
NOISE_KEY_2,
|
||||||
Nwaku,
|
Nwaku,
|
||||||
} from "../../test_utils";
|
} from "../../test_utils";
|
||||||
import { delay } from "../../test_utils/delay";
|
|
||||||
import {
|
import {
|
||||||
generatePrivateKey,
|
generatePrivateKey,
|
||||||
generateSymmetricKey,
|
generateSymmetricKey,
|
||||||
|
@ -278,14 +277,7 @@ describe("Waku Store", () => {
|
||||||
|
|
||||||
dbg("Waku nodes connected to nwaku");
|
dbg("Waku nodes connected to nwaku");
|
||||||
|
|
||||||
let lightPushPeerFound = false;
|
await waku1.waitForRemotePeer([Protocols.LightPush]);
|
||||||
while (!lightPushPeerFound) {
|
|
||||||
await delay(100);
|
|
||||||
for await (const _peer of waku1.lightPush.peers) {
|
|
||||||
lightPushPeerFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dbg("Sending messages using light push");
|
dbg("Sending messages using light push");
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -295,14 +287,7 @@ describe("Waku Store", () => {
|
||||||
waku1.lightPush.push(clearMessage),
|
waku1.lightPush.push(clearMessage),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let storePeerFound = false;
|
await waku2.waitForRemotePeer([Protocols.Store]);
|
||||||
while (!storePeerFound) {
|
|
||||||
await delay(100);
|
|
||||||
for await (const _peer of waku2.store.peers) {
|
|
||||||
storePeerFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
waku2.store.addDecryptionKey(symKey);
|
waku2.store.addDecryptionKey(symKey);
|
||||||
|
|
||||||
|
@ -396,14 +381,7 @@ describe("Waku Store", () => {
|
||||||
|
|
||||||
dbg("Waku nodes connected to nwaku");
|
dbg("Waku nodes connected to nwaku");
|
||||||
|
|
||||||
let lightPushPeerFound = false;
|
await waku1.waitForRemotePeer([Protocols.LightPush]);
|
||||||
while (!lightPushPeerFound) {
|
|
||||||
await delay(100);
|
|
||||||
for await (const _peer of waku1.lightPush.peers) {
|
|
||||||
lightPushPeerFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dbg("Sending messages using light push");
|
dbg("Sending messages using light push");
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -413,14 +391,7 @@ describe("Waku Store", () => {
|
||||||
waku1.lightPush.push(clearMessage),
|
waku1.lightPush.push(clearMessage),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let storePeerFound = false;
|
await waku2.waitForRemotePeer([Protocols.Store]);
|
||||||
while (!storePeerFound) {
|
|
||||||
await delay(100);
|
|
||||||
for await (const _peer of waku2.store.peers) {
|
|
||||||
storePeerFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
waku2.addDecryptionKey(symKey, {
|
waku2.addDecryptionKey(symKey, {
|
||||||
contentTopics: [encryptedSymmetricContentTopic],
|
contentTopics: [encryptedSymmetricContentTopic],
|
||||||
|
|
Loading…
Reference in New Issue