From d08da942339b86b2458ab06585e2f6e4ed30647b Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 24 Jan 2022 18:39:28 +0900 Subject: feat(unstable): add Deno.networkInterfaces (#13475) --- cli/tests/unit/network_interfaces_test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 cli/tests/unit/network_interfaces_test.ts (limited to 'cli/tests/unit') diff --git a/cli/tests/unit/network_interfaces_test.ts b/cli/tests/unit/network_interfaces_test.ts new file mode 100644 index 000000000..120f58763 --- /dev/null +++ b/cli/tests/unit/network_interfaces_test.ts @@ -0,0 +1,25 @@ +import { assert } from "./test_util.ts"; + +Deno.test( + { name: "Deno.networkInterfaces", permissions: { env: true } }, + () => { + const networkInterfaces = Deno.networkInterfaces(); + assert(Array.isArray(networkInterfaces)); + assert(networkInterfaces.length > 0); + for ( + const { name, family, address, netmask, scopeid, cidr, mac } + of networkInterfaces + ) { + assert(typeof name === "string"); + assert(family === "IPv4" || family === "IPv6"); + assert(typeof address === "string"); + assert(typeof netmask === "string"); + assert( + (family === "IPv6" && typeof scopeid === "number") || + (family === "IPv4" && scopeid === null), + ); + assert(typeof cidr === "string"); + assert(typeof mac === "string"); + } + }, +); -- cgit v1.2.3