mirror of https://github.com/waku-org/js-waku.git
Merge pull request #900 from waku-org/filter
This commit is contained in:
commit
5ba874065d
|
@ -1,7 +1,7 @@
|
||||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||||
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||||
import { createFullNode, createLightNode } from "@waku/create";
|
import { createLightNode } from "@waku/create";
|
||||||
import { DecodedMessage, Protocols, WakuLight } from "@waku/interfaces";
|
import { DecodedMessage, Protocols, WakuLight } from "@waku/interfaces";
|
||||||
import {
|
import {
|
||||||
AsymDecoder,
|
AsymDecoder,
|
||||||
|
@ -83,10 +83,10 @@ describe("Waku Message Ephemeral field", () => {
|
||||||
const symDecoder = new SymDecoder(SymContentTopic, symKey);
|
const symDecoder = new SymDecoder(SymContentTopic, symKey);
|
||||||
|
|
||||||
const [waku1, waku2, nimWakuMultiaddr] = await Promise.all([
|
const [waku1, waku2, nimWakuMultiaddr] = await Promise.all([
|
||||||
createFullNode({
|
createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
createFullNode({
|
createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_2,
|
staticNoiseKey: NOISE_KEY_2,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
nwaku.getMultiaddrWithId(),
|
nwaku.getMultiaddrWithId(),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||||
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||||
import { createFullNode } from "@waku/create";
|
import { createLightNode } from "@waku/create";
|
||||||
import type { DecodedMessage, WakuFull } from "@waku/interfaces";
|
import type { DecodedMessage, WakuLight } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import debug from "debug";
|
import debug from "debug";
|
||||||
|
@ -17,7 +17,7 @@ const TestEncoder = new EncoderV0(TestContentTopic);
|
||||||
const TestDecoder = new DecoderV0(TestContentTopic);
|
const TestDecoder = new DecoderV0(TestContentTopic);
|
||||||
|
|
||||||
describe("Waku Filter", () => {
|
describe("Waku Filter", () => {
|
||||||
let waku: WakuFull;
|
let waku: WakuLight;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
@ -29,7 +29,7 @@ describe("Waku Filter", () => {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new Nwaku(makeLogFileName(this));
|
nwaku = new Nwaku(makeLogFileName(this));
|
||||||
await nwaku.start({ filter: true, lightpush: true });
|
await nwaku.start({ filter: true, lightpush: true });
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||||
import { EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
import { EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||||
import { createFullNode } from "@waku/create";
|
import { createLightNode } from "@waku/create";
|
||||||
import type { WakuFull } from "@waku/interfaces";
|
import type { WakuLight } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import debug from "debug";
|
import debug from "debug";
|
||||||
|
@ -21,7 +21,7 @@ const TestContentTopic = "/test/1/waku-light-push/utf8";
|
||||||
const TestEncoder = new EncoderV0(TestContentTopic);
|
const TestEncoder = new EncoderV0(TestContentTopic);
|
||||||
|
|
||||||
describe("Waku Light Push [node only]", () => {
|
describe("Waku Light Push [node only]", () => {
|
||||||
let waku: WakuFull;
|
let waku: WakuLight;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
@ -35,7 +35,7 @@ describe("Waku Light Push [node only]", () => {
|
||||||
nwaku = new Nwaku(makeLogFileName(this));
|
nwaku = new Nwaku(makeLogFileName(this));
|
||||||
await nwaku.start({ lightpush: true });
|
await nwaku.start({ lightpush: true });
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -68,7 +68,7 @@ describe("Waku Light Push [node only]", () => {
|
||||||
nwaku = new Nwaku(makeLogFileName(this));
|
nwaku = new Nwaku(makeLogFileName(this));
|
||||||
await nwaku.start({ lightpush: true, topics: customPubSubTopic });
|
await nwaku.start({ lightpush: true, topics: customPubSubTopic });
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
pubSubTopic: customPubSubTopic,
|
pubSubTopic: customPubSubTopic,
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||||
import { createCursor, PageDirection } from "@waku/core";
|
import { createCursor, PageDirection } from "@waku/core";
|
||||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||||
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||||
import { createFullNode } from "@waku/create";
|
import { createLightNode } from "@waku/create";
|
||||||
import { DecodedMessage, Message, WakuFull } from "@waku/interfaces";
|
import { DecodedMessage, Message, WakuLight } from "@waku/interfaces";
|
||||||
import { Protocols } from "@waku/interfaces";
|
import { Protocols } from "@waku/interfaces";
|
||||||
import {
|
import {
|
||||||
AsymDecoder,
|
AsymDecoder,
|
||||||
|
@ -27,7 +27,7 @@ const TestEncoder = new EncoderV0(TestContentTopic);
|
||||||
const TestDecoder = new DecoderV0(TestContentTopic);
|
const TestDecoder = new DecoderV0(TestContentTopic);
|
||||||
|
|
||||||
describe("Waku Store", () => {
|
describe("Waku Store", () => {
|
||||||
let waku: WakuFull;
|
let waku: WakuLight;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
|
@ -56,7 +56,7 @@ describe("Waku Store", () => {
|
||||||
).to.be.true;
|
).to.be.true;
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -87,7 +87,7 @@ describe("Waku Store", () => {
|
||||||
it("Generator, no message returned", async function () {
|
it("Generator, no message returned", async function () {
|
||||||
this.timeout(15_000);
|
this.timeout(15_000);
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -126,7 +126,7 @@ describe("Waku Store", () => {
|
||||||
).to.be.true;
|
).to.be.true;
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -183,7 +183,7 @@ describe("Waku Store", () => {
|
||||||
).to.be.true;
|
).to.be.true;
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -224,7 +224,7 @@ describe("Waku Store", () => {
|
||||||
).to.be.true;
|
).to.be.true;
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -264,7 +264,7 @@ describe("Waku Store", () => {
|
||||||
await delay(1); // to ensure each timestamp is unique.
|
await delay(1); // to ensure each timestamp is unique.
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -303,7 +303,7 @@ describe("Waku Store", () => {
|
||||||
await delay(1); // to ensure each timestamp is unique.
|
await delay(1); // to ensure each timestamp is unique.
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -372,10 +372,10 @@ describe("Waku Store", () => {
|
||||||
const symDecoder = new SymDecoder(symTopic, symKey);
|
const symDecoder = new SymDecoder(symTopic, symKey);
|
||||||
|
|
||||||
const [waku1, waku2, nimWakuMultiaddr] = await Promise.all([
|
const [waku1, waku2, nimWakuMultiaddr] = await Promise.all([
|
||||||
createFullNode({
|
createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
createFullNode({
|
createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_2,
|
staticNoiseKey: NOISE_KEY_2,
|
||||||
}).then((waku) => waku.start().then(() => waku)),
|
}).then((waku) => waku.start().then(() => waku)),
|
||||||
nwaku.getMultiaddrWithId(),
|
nwaku.getMultiaddrWithId(),
|
||||||
|
@ -462,7 +462,7 @@ describe("Waku Store", () => {
|
||||||
).to.be.true;
|
).to.be.true;
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -524,7 +524,7 @@ describe("Waku Store", () => {
|
||||||
await delay(1); // to ensure each timestamp is unique.
|
await delay(1); // to ensure each timestamp is unique.
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
@ -548,7 +548,7 @@ describe("Waku Store", () => {
|
||||||
|
|
||||||
describe("Waku Store, custom pubsub topic", () => {
|
describe("Waku Store, custom pubsub topic", () => {
|
||||||
const customPubSubTopic = "/waku/2/custom-dapp/proto";
|
const customPubSubTopic = "/waku/2/custom-dapp/proto";
|
||||||
let waku: WakuFull;
|
let waku: WakuLight;
|
||||||
let nwaku: Nwaku;
|
let nwaku: Nwaku;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
|
@ -581,7 +581,7 @@ describe("Waku Store, custom pubsub topic", () => {
|
||||||
).to.be.true;
|
).to.be.true;
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await createFullNode({
|
waku = await createLightNode({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
pubSubTopic: customPubSubTopic,
|
pubSubTopic: customPubSubTopic,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue