Skip to content

Commit ca3436b

Browse files
committed
test: change 'node_unit_tests::tls_test' to use local server
1 parent bc85548 commit ca3436b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/unit_node/tls_test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,19 @@ Connection: close
100100

101101
// Regression at https://github.com/denoland/deno/issues/27652
102102
Deno.test("tls.connect makes tls connection to example.com", async () => {
103-
const socket = tls.connect(443, "example.com");
103+
const socket = tls.connect({
104+
port: 4557,
105+
host: "localhost",
106+
// deno-lint-ignore no-explicit-any
107+
secureContext: { ca: rootCaCert } as any,
108+
});
104109
await new Promise((resolve) => {
105110
socket.on("secureConnect", resolve);
106111
});
107112
socket.write(
108-
"GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n",
113+
"GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n",
109114
);
110-
assertStringIncludes(await text(socket), "<title>Example Domain</title>");
115+
assertStringIncludes(await text(socket), "PASS");
111116
});
112117

113118
// https://github.com/denoland/deno/pull/20120

0 commit comments

Comments
 (0)