mirror of https://github.com/status-im/js-waku.git
chore: move tests to remove circular dep
This commit is contained in:
parent
9d54462893
commit
b11d465a9d
|
@ -9,6 +9,10 @@
|
|||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
},
|
||||
"./lib/enr": {
|
||||
"types": "./dist/lib/enr/index.d.ts",
|
||||
"import": "./dist/lib/enr/index.js"
|
||||
},
|
||||
"./lib/peer_discovery_dns": {
|
||||
"types": "./dist/lib/peer_discovery_dns/index.d.ts",
|
||||
"import": "./dist/lib/peer_discovery_dns/index.js"
|
||||
|
@ -21,6 +25,10 @@
|
|||
"types": "./dist/lib/predefined_bootstrap_nodes.d.ts",
|
||||
"import": "./dist/lib/predefined_bootstrap_nodes.js"
|
||||
},
|
||||
"./lib/utils": {
|
||||
"types": "./dist/lib/utils.d.ts",
|
||||
"import": "./dist/lib/utils.js"
|
||||
},
|
||||
"./lib/wait_for_remote_peer": {
|
||||
"types": "./dist/lib/wait_for_remote_peer.d.ts",
|
||||
"import": "./dist/lib/wait_for_remote_peer.js"
|
||||
|
|
|
@ -5,9 +5,11 @@ import json from "@rollup/plugin-json";
|
|||
export default {
|
||||
input: {
|
||||
index: "dist/index.js",
|
||||
"lib/enr": "dist/lib/enr/index.js",
|
||||
"lib/peer_discovery_dns": "dist/lib/peer_discovery_dns/index.js",
|
||||
"lib/peer_discovery_static_list": "dist/lib/peer_discovery_static_list.js",
|
||||
"lib/predefined_bootstrap_nodes": "dist/lib/predefined_bootstrap_nodes.js",
|
||||
"lib/utils": "dist/lib/utils.js",
|
||||
"lib/wait_for_remote_peer": "dist/lib/wait_for_remote_peer.js",
|
||||
"lib/waku_message/version_0": "dist/lib/waku_message/version_0.js",
|
||||
"lib/waku_message/version_1": "dist/lib/waku_message/version_1.js",
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
"entryPoints": [
|
||||
"./src/index.ts",
|
||||
"./src/lib/enr/index.ts",
|
||||
"./src/lib/peer_discovery_dns.ts",
|
||||
"./src/lib/peer_discovery_static_list.ts",
|
||||
"./src/lib/predefined_bootstrap_nodes.ts",
|
||||
"./src/lib/utils.ts",
|
||||
"./src/lib/wait_for_remote_peer.ts",
|
||||
"./src/lib/waku_message/version_0.ts",
|
||||
"./src/lib/waku_message/version_1.ts",
|
||||
|
|
|
@ -3,4 +3,7 @@ module.exports = {
|
|||
tsconfigRootDir: __dirname,
|
||||
project: "./tsconfig.json",
|
||||
},
|
||||
rules: {
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"extension": ["ts"],
|
||||
"spec": "src/**/*.spec.ts",
|
||||
"spec": "tests/**/*.spec.ts",
|
||||
"require": ["ts-node/register", "isomorphic-fetch", "jsdom-global/register"],
|
||||
"loader": "ts-node/esm",
|
||||
"node-option": [
|
||||
|
|
|
@ -43,12 +43,20 @@
|
|||
"scripts": {
|
||||
"fix": "run-s fix:*",
|
||||
"fix:prettier": "prettier . --write",
|
||||
"fix:lint": "eslint tests --ext .ts --ext .cjs --fix",
|
||||
"fix:lint": "eslint src tests --ext .ts --ext .cjs --fix",
|
||||
"pretest": "run-s pretest:*",
|
||||
"pretest:1-init-git-submodules": "[ -f '../../nwaku/build/wakunode2' ] || git submodule update --init --recursive",
|
||||
"pretest:2-build-nwaku": "[ -f '../../nwaku/build/wakunode2' ] || run-s nwaku:build",
|
||||
"nwaku:build": "(PROC=$(nproc --all 2>/dev/null || echo 2); cd ../../nwaku; make -j$PROC update; NIMFLAGS=\"-d:chronicles_colors=off -d:chronicles_sinks=textlines -d:chronicles_log_level=TRACE\" make -j$PROC wakunode2)",
|
||||
"nwaku:force-build": "(cd ../../nwaku && rm -rf ./build/ ./vendor) && run-s nwaku:build",
|
||||
"check": "run-s check:*",
|
||||
"check:lint": "eslint tests --ext .ts",
|
||||
"check:lint": "eslint src tests --ext .ts",
|
||||
"check:prettier": "prettier . --list-different",
|
||||
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
|
||||
"check:spelling": "cspell \"{README.md,{tests,src}/**/*.ts}\"",
|
||||
"check:tsc": "tsc -p tsconfig.json",
|
||||
"test": "run-s test:*",
|
||||
"test:node": "TS_NODE_PROJECT=./tsconfig.json mocha",
|
||||
"test:browser": "karma start karma.conf.cjs",
|
||||
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
/**
|
||||
* @hidden
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { ChildProcess, spawn } from "child_process";
|
||||
|
||||
import type { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { peerIdFromString } from "@libp2p/peer-id";
|
||||
import { Multiaddr, multiaddr } from "@multiformats/multiaddr";
|
||||
import { DefaultPubSubTopic } from "@waku/core";
|
||||
import { utils } from "@waku/core";
|
||||
import appRoot from "app-root-path";
|
||||
import debug from "debug";
|
||||
import portfinder from "portfinder";
|
||||
|
||||
import { DefaultPubSubTopic } from "../lib/constants";
|
||||
import { bytesToHex, hexToBytes } from "../lib/utils";
|
||||
|
||||
import { existsAsync, mkdirAsync, openAsync } from "./async_fs";
|
||||
import { delay } from "./delay";
|
||||
import waitForLine from "./log_file";
|
||||
|
||||
const { bytesToHex, hexToBytes } = utils;
|
||||
|
||||
const log = debug("waku:nwaku");
|
||||
|
||||
const WAKU_SERVICE_NODE_DIR =
|
|
@ -1,12 +1,11 @@
|
|||
import { ENR } from "@waku/core/lib/enr";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { createPrivacyNode } from "@waku/create";
|
||||
import type { WakuPrivacy } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
import { expect } from "chai";
|
||||
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../../test_utils";
|
||||
import { waitForRemotePeer } from "../wait_for_remote_peer";
|
||||
|
||||
import { ENR } from "./enr";
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src";
|
||||
|
||||
describe("ENR Interop: nwaku", function () {
|
||||
let waku: WakuPrivacy;
|
||||
|
@ -32,6 +31,8 @@ describe("ENR Interop: nwaku", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waitForRemotePeer(waku, [Protocols.Relay]);
|
||||
|
||||
|
@ -64,6 +65,8 @@ describe("ENR Interop: nwaku", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waitForRemotePeer(waku, [Protocols.Relay]);
|
||||
|
||||
|
@ -96,6 +99,8 @@ describe("ENR Interop: nwaku", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waitForRemotePeer(waku, [Protocols.Relay]);
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||
import { createFullNode } from "@waku/create";
|
||||
import type { Message, WakuFull } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
import { expect } from "chai";
|
||||
import debug from "debug";
|
||||
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../../test_utils";
|
||||
import { delay } from "../../test_utils/delay";
|
||||
import { bytesToUtf8, utf8ToBytes } from "../utils";
|
||||
import { waitForRemotePeer } from "../wait_for_remote_peer";
|
||||
import { DecoderV0, EncoderV0 } from "../waku_message/version_0";
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src";
|
||||
import { delay } from "../src/delay";
|
||||
|
||||
const log = debug("waku:test");
|
||||
|
||||
|
@ -34,6 +34,8 @@ describe("Waku Filter", () => {
|
|||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Filter, Protocols.LightPush]);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||
import { createFullNode } from "@waku/create";
|
||||
import type { WakuFull } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
|
@ -9,11 +12,8 @@ import {
|
|||
MessageRpcResponse,
|
||||
NOISE_KEY_1,
|
||||
Nwaku,
|
||||
} from "../../test_utils";
|
||||
import { delay } from "../../test_utils/delay";
|
||||
import { bytesToUtf8, utf8ToBytes } from "../utils";
|
||||
import { waitForRemotePeer } from "../wait_for_remote_peer";
|
||||
import { EncoderV0 } from "../waku_message/version_0";
|
||||
} from "../src";
|
||||
import { delay } from "../src/delay";
|
||||
|
||||
const log = debug("waku:test:lightpush");
|
||||
|
||||
|
@ -39,6 +39,8 @@ describe("Waku Light Push [node only]", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.LightPush]);
|
||||
|
||||
|
@ -73,6 +75,8 @@ describe("Waku Light Push [node only]", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.LightPush]);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
|
||||
import { makeLogFileName } from "./log_file";
|
||||
import { makeLogFileName } from "../src";
|
||||
|
||||
describe("This", function () {
|
||||
describe("Is", function () {
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
|
||||
import { argsToArray, defaultArgs } from "./nwaku";
|
||||
import { argsToArray, defaultArgs } from "../src";
|
||||
|
||||
describe("nwaku", () => {
|
||||
it("Correctly serialized arguments", function () {
|
|
@ -1,4 +1,23 @@
|
|||
import { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { DefaultPubSubTopic } from "@waku/core";
|
||||
import {
|
||||
generatePrivateKey,
|
||||
generateSymmetricKey,
|
||||
getPublicKey,
|
||||
} from "@waku/core";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import {
|
||||
DecoderV0,
|
||||
EncoderV0,
|
||||
MessageV0,
|
||||
} from "@waku/core/lib/waku_message/version_0";
|
||||
import {
|
||||
AsymDecoder,
|
||||
AsymEncoder,
|
||||
SymDecoder,
|
||||
SymEncoder,
|
||||
} from "@waku/core/lib/waku_message/version_1";
|
||||
import { createPrivacyNode } from "@waku/create";
|
||||
import type { Message, WakuPrivacy } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
|
@ -12,23 +31,8 @@ import {
|
|||
NOISE_KEY_2,
|
||||
NOISE_KEY_3,
|
||||
Nwaku,
|
||||
} from "../../test_utils";
|
||||
import { delay } from "../../test_utils/delay";
|
||||
import { DefaultPubSubTopic } from "../constants";
|
||||
import {
|
||||
generatePrivateKey,
|
||||
generateSymmetricKey,
|
||||
getPublicKey,
|
||||
} from "../crypto";
|
||||
import { bytesToUtf8, utf8ToBytes } from "../utils";
|
||||
import { waitForRemotePeer } from "../wait_for_remote_peer";
|
||||
import { DecoderV0, EncoderV0, MessageV0 } from "../waku_message/version_0.js";
|
||||
import {
|
||||
AsymDecoder,
|
||||
AsymEncoder,
|
||||
SymDecoder,
|
||||
SymEncoder,
|
||||
} from "../waku_message/version_1.js";
|
||||
} from "../src";
|
||||
import { delay } from "../src/delay";
|
||||
|
||||
const log = debug("waku:test");
|
||||
|
||||
|
@ -342,6 +346,8 @@ describe("Waku Relay [node only]", () => {
|
|||
nwaku = new Nwaku(this.test?.ctx?.currentTest?.title + "");
|
||||
await nwaku.start();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Relay]);
|
||||
});
|
||||
|
@ -439,7 +445,11 @@ describe("Waku Relay [node only]", () => {
|
|||
|
||||
const nwakuMultiaddr = await nwaku.getMultiaddrWithId();
|
||||
await Promise.all([
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
waku1.dial(nwakuMultiaddr),
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
waku2.dial(nwakuMultiaddr),
|
||||
]);
|
||||
|
||||
|
|
|
@ -1,31 +1,25 @@
|
|||
import {
|
||||
generatePrivateKey,
|
||||
generateSymmetricKey,
|
||||
getPublicKey,
|
||||
} from "@waku/core";
|
||||
import { PageDirection } from "@waku/core";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||
import {
|
||||
AsymDecoder,
|
||||
AsymEncoder,
|
||||
SymDecoder,
|
||||
SymEncoder,
|
||||
} from "@waku/core/lib/waku_message/version_1";
|
||||
import { createFullNode } from "@waku/create";
|
||||
import type { Message, WakuFull } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
import { expect } from "chai";
|
||||
import debug from "debug";
|
||||
|
||||
import {
|
||||
makeLogFileName,
|
||||
NOISE_KEY_1,
|
||||
NOISE_KEY_2,
|
||||
Nwaku,
|
||||
} from "../../test_utils";
|
||||
import {
|
||||
generatePrivateKey,
|
||||
generateSymmetricKey,
|
||||
getPublicKey,
|
||||
} from "../crypto";
|
||||
import { bytesToUtf8, utf8ToBytes } from "../utils";
|
||||
import { waitForRemotePeer } from "../wait_for_remote_peer";
|
||||
import { DecoderV0, EncoderV0 } from "../waku_message/version_0.js";
|
||||
import {
|
||||
AsymDecoder,
|
||||
AsymEncoder,
|
||||
SymDecoder,
|
||||
SymEncoder,
|
||||
} from "../waku_message/version_1.js";
|
||||
|
||||
import { PageDirection } from "./history_rpc";
|
||||
import { makeLogFileName, NOISE_KEY_1, NOISE_KEY_2, Nwaku } from "../src";
|
||||
|
||||
const log = debug("waku:test:store");
|
||||
|
||||
|
@ -67,6 +61,8 @@ describe("Waku Store", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
@ -98,6 +94,8 @@ describe("Waku Store", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
@ -138,6 +136,8 @@ describe("Waku Store", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
@ -179,6 +179,8 @@ describe("Waku Store", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
@ -218,6 +220,8 @@ describe("Waku Store", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
@ -261,6 +265,8 @@ describe("Waku Store", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
@ -343,7 +349,11 @@ describe("Waku Store", () => {
|
|||
log("Waku nodes created");
|
||||
|
||||
await Promise.all([
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
waku1.dial(nimWakuMultiaddr),
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
waku2.dial(nimWakuMultiaddr),
|
||||
]);
|
||||
|
||||
|
@ -425,6 +435,8 @@ describe("Waku Store", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
@ -486,6 +498,8 @@ describe("Waku Store", () => {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
@ -545,6 +559,8 @@ describe("Waku Store, custom pubsub topic", () => {
|
|||
pubSubTopic: customPubSubTopic,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Store]);
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { createLightNode, createPrivacyNode } from "@waku/create";
|
||||
import type { WakuLight, WakuPrivacy } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
import { expect } from "chai";
|
||||
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../test_utils";
|
||||
import { delay } from "../test_utils/delay";
|
||||
|
||||
import { waitForRemotePeer } from "./wait_for_remote_peer";
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src";
|
||||
import { delay } from "../src/delay";
|
||||
|
||||
describe("Wait for remote peer", function () {
|
||||
let waku1: WakuPrivacy;
|
||||
|
@ -37,6 +36,8 @@ describe("Wait for remote peer", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku1.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku1.dial(multiAddrWithId);
|
||||
await delay(1000);
|
||||
await waitForRemotePeer(waku1, [Protocols.Relay]);
|
||||
|
@ -65,6 +66,8 @@ describe("Wait for remote peer", function () {
|
|||
|
||||
const waitPromise = waitForRemotePeer(waku1, [Protocols.Relay]);
|
||||
await delay(1000);
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku1.dial(multiAddrWithId);
|
||||
await waitPromise;
|
||||
|
||||
|
@ -110,6 +113,8 @@ describe("Wait for remote peer", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku2.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku2.dial(multiAddrWithId);
|
||||
await delay(1000);
|
||||
await waitForRemotePeer(waku2, [Protocols.Store]);
|
||||
|
@ -139,6 +144,8 @@ describe("Wait for remote peer", function () {
|
|||
await waku2.start();
|
||||
const waitPromise = waitForRemotePeer(waku2, [Protocols.Store], 2000);
|
||||
await delay(1000);
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku2.dial(multiAddrWithId);
|
||||
await waitPromise;
|
||||
|
||||
|
@ -165,6 +172,8 @@ describe("Wait for remote peer", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku2.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku2.dial(multiAddrWithId);
|
||||
await waitForRemotePeer(waku2, [Protocols.LightPush]);
|
||||
|
||||
|
@ -193,6 +202,8 @@ describe("Wait for remote peer", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku2.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku2.dial(multiAddrWithId);
|
||||
await waitForRemotePeer(waku2, [Protocols.Filter]);
|
||||
|
||||
|
@ -222,6 +233,8 @@ describe("Wait for remote peer", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku2.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku2.dial(multiAddrWithId);
|
||||
await waitForRemotePeer(waku2);
|
||||
|
||||
|
@ -258,10 +271,12 @@ describe("Wait for remote peer", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku1.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku1.dial(multiAddrWithId);
|
||||
await waitForRemotePeer(waku1);
|
||||
|
||||
const peers = await waku1.relay.getMeshPeers();
|
||||
const peers = waku1.relay.getMeshPeers();
|
||||
|
||||
const nimPeerId = multiAddrWithId.getPeerId();
|
||||
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import type { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { generateSymmetricKey } from "@waku/core";
|
||||
import { PeerDiscoveryStaticPeers } from "@waku/core/lib/peer_discovery_static_list";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { SymDecoder, SymEncoder } from "@waku/core/lib/waku_message/version_1";
|
||||
import { createLightNode, createPrivacyNode } from "@waku/create";
|
||||
import type { Message, Waku, WakuLight, WakuPrivacy } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
import { expect } from "chai";
|
||||
|
||||
import {
|
||||
makeLogFileName,
|
||||
NOISE_KEY_1,
|
||||
NOISE_KEY_2,
|
||||
Nwaku,
|
||||
} from "../test_utils/";
|
||||
|
||||
import { generateSymmetricKey } from "./crypto";
|
||||
import { PeerDiscoveryStaticPeers } from "./peer_discovery_static_list";
|
||||
import { bytesToUtf8, utf8ToBytes } from "./utils";
|
||||
import { waitForRemotePeer } from "./wait_for_remote_peer";
|
||||
import { SymDecoder, SymEncoder } from "./waku_message/version_1.js";
|
||||
import { makeLogFileName, NOISE_KEY_1, NOISE_KEY_2, Nwaku } from "../src/";
|
||||
|
||||
const TestContentTopic = "/test/1/waku/utf8";
|
||||
|
||||
|
@ -44,6 +38,8 @@ describe("Waku Dial [node only]", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waitForRemotePeer(waku);
|
||||
|
||||
|
@ -70,6 +66,8 @@ describe("Waku Dial [node only]", function () {
|
|||
waku = await createLightNode({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
libp2p: {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
peerDiscovery: [new PeerDiscoveryStaticPeers([multiAddrWithId])],
|
||||
},
|
||||
});
|
||||
|
@ -97,6 +95,8 @@ describe("Waku Dial [node only]", function () {
|
|||
staticNoiseKey: NOISE_KEY_1,
|
||||
libp2p: {
|
||||
peerDiscovery: [
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore TODO: uniformize usage of multiaddr lib across repos
|
||||
new PeerDiscoveryStaticPeers([await nwaku.getMultiaddrWithId()]),
|
||||
],
|
||||
},
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
"compilerOptions": {
|
||||
"incremental": true,
|
||||
"target": "es2020",
|
||||
"outDir": "dist/",
|
||||
"rootDir": "tests",
|
||||
"noEmit": true,
|
||||
"moduleResolution": "node",
|
||||
"module": "esnext",
|
||||
|
@ -46,7 +44,7 @@
|
|||
"types": ["node", "mocha"],
|
||||
"typeRoots": ["node_modules/@types", "src/types"]
|
||||
},
|
||||
"include": ["tests"],
|
||||
"include": ["tests", "src"],
|
||||
"compileOnSave": false,
|
||||
"ts-node": {
|
||||
"files": true
|
||||
|
|
Loading…
Reference in New Issue