Skip to content

Commit

Permalink
client test
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Oct 19, 2024
1 parent 0783875 commit 4e0a88a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/engine.io-client/test/webtransport.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Http3Server, WebTransport } from "@fails-components/webtransport";
import { Http3EventLoop } from "@fails-components/webtransport/lib/event-loop.js";
import expect from "expect.js";
import { Server } from "engine.io";
import { Socket } from "../build/esm-debug/index.js";
Expand All @@ -16,7 +15,7 @@ async function setup(opts, cb) {
const certificate = await generateWebTransportCertificate(
[{ shortName: "CN", value: "localhost" }],
{
days: 14, // the total length of the validity period MUST NOT exceed two weeks (https://w3c.github.io/webtransport/#custom-certificate-requirements)
days: 13, // the total length of the validity period MUST NOT exceed two weeks (https://w3c.github.io/webtransport/#custom-certificate-requirements)
},
);

Expand Down Expand Up @@ -48,7 +47,10 @@ async function setup(opts, cb) {
})();

h3Server.startServer();
h3Server.onServerListening = () => cb({ engine, h3Server, certificate });

await h3Server.ready;

cb({ engine, h3Server, certificate });
}

function success(engine, h3server, done) {
Expand Down Expand Up @@ -79,10 +81,6 @@ function createSocket(port, certificate, opts) {
}

describe("WebTransport", () => {
after(() => {
Http3EventLoop.globalLoop.shutdownEventLoop(); // manually shutdown the event loop, instead of waiting 20s
});

it("should allow to connect with WebTransport directly", (done) => {
setup({}, ({ engine, h3Server, certificate }) => {
const socket = createSocket(h3Server.port, certificate, {
Expand Down

0 comments on commit 4e0a88a

Please sign in to comment.