chore: ensure that we can dial `tls` multiaddrs (#1580)

* add a test to dial tls version of a multiaddr

* generate new lockfile
ref: https://github.com/libp2p/js-libp2p/pull/2059#issuecomment-1724031879
This commit is contained in:
Danish Arora 2023-09-22 15:56:52 +05:30 committed by GitHub
parent 36785fcb15
commit a718c40882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6257 additions and 27055 deletions

33272
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
import { multiaddr } from "@multiformats/multiaddr";
import type { Waku } from "@waku/interfaces";
import { createLightNode } from "@waku/sdk";
import { expect } from "chai";
import { NimGoNode } from "../src/index.js";
describe("dials multiaddr", function () {
let waku: Waku;
let nwaku: NimGoNode;
afterEach(async function () {
!!nwaku &&
nwaku.stop().catch((e) => console.log("Nwaku failed to stop", e));
!!waku && waku.stop().catch((e) => console.log("Waku failed to stop", e));
});
it("TLS", async function () {
this.timeout(20_000);
let tlsWorks = true;
waku = await createLightNode();
await waku.start();
try {
// dummy multiaddr, doesn't have to be valid
await waku.dial(multiaddr(`/ip4/127.0.0.1/tcp/30303/tls/ws`));
} catch (error) {
if (error instanceof Error) {
// if the error is of tls unsupported, the test should fail
// for any other dial errors, the test should pass
if (error.message === "Unsupported protocol tls") {
tlsWorks = false;
}
}
}
expect(tlsWorks).to.eq(true);
});
});