Skip to content

Commit

Permalink
test: change 'node_unit_tests::tls_test' to use local server
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Feb 5, 2025
1 parent bc85548 commit ca3436b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/unit_node/tls_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,19 @@ Connection: close

// Regression at https://github.com/denoland/deno/issues/27652
Deno.test("tls.connect makes tls connection to example.com", async () => {
const socket = tls.connect(443, "example.com");
const socket = tls.connect({
port: 4557,
host: "localhost",
// deno-lint-ignore no-explicit-any
secureContext: { ca: rootCaCert } as any,
});
await new Promise((resolve) => {
socket.on("secureConnect", resolve);
});
socket.write(
"GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n",
"GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n",
);
assertStringIncludes(await text(socket), "<title>Example Domain</title>");
assertStringIncludes(await text(socket), "PASS");
});

// https://github.com/denoland/deno/pull/20120
Expand Down

0 comments on commit ca3436b

Please sign in to comment.