From ab1e391e1d700a68964e899963670e903f498cdf Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 18 Sep 2024 21:14:26 +0200 Subject: feat(ext/node): add rootCertificates to node:tls (#25707) Closes https://github.com/denoland/deno/issues/25604 Signed-off-by: Satya Rohith Co-authored-by: Satya Rohith --- tests/unit_node/tls_test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/unit_node') diff --git a/tests/unit_node/tls_test.ts b/tests/unit_node/tls_test.ts index 6826ab84c..7daa544c7 100644 --- a/tests/unit_node/tls_test.ts +++ b/tests/unit_node/tls_test.ts @@ -1,9 +1,11 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { + assert, assertEquals, assertInstanceOf, assertStringIncludes, + assertThrows, } from "@std/assert"; import { delay } from "@std/async/delay"; import { fromFileUrl, join } from "@std/path"; @@ -215,3 +217,13 @@ Deno.test("tls.connect() throws InvalidData when there's error in certificate", "InvalidData: invalid peer certificate: UnknownIssuer", ); }); + +Deno.test("tls.rootCertificates is not empty", () => { + assert(tls.rootCertificates.length > 0); + assert(Object.isFrozen(tls.rootCertificates)); + assert(tls.rootCertificates instanceof Array); + assert(tls.rootCertificates.every((cert) => typeof cert === "string")); + assertThrows(() => { + (tls.rootCertificates as string[]).push("new cert"); + }, TypeError); +}); -- cgit v1.2.3