summaryrefslogtreecommitdiff
path: root/tests/unit_node
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-09-18 21:14:26 +0200
committerGitHub <noreply@github.com>2024-09-18 21:14:26 +0200
commitab1e391e1d700a68964e899963670e903f498cdf (patch)
tree923a469665b841605d81b7f615658a0bb363c35c /tests/unit_node
parent5b14c71dafc119d5cf251d6e63cb5f53a661a391 (diff)
feat(ext/node): add rootCertificates to node:tls (#25707)
Closes https://github.com/denoland/deno/issues/25604 Signed-off-by: Satya Rohith <me@satyarohith.com> Co-authored-by: Satya Rohith <me@satyarohith.com>
Diffstat (limited to 'tests/unit_node')
-rw-r--r--tests/unit_node/tls_test.ts12
1 files changed, 12 insertions, 0 deletions
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);
+});