summaryrefslogtreecommitdiff
path: root/std/node/os_test.ts
diff options
context:
space:
mode:
authorecyrbe <ecyrbe@gmail.com>2020-02-23 00:46:52 +0100
committerGitHub <noreply@github.com>2020-02-22 18:46:52 -0500
commitfb98556d56d0defa325fab1296077627cce31aab (patch)
treec5589b7cdc21d56d440ab13a1abc527cf072b103 /std/node/os_test.ts
parentc34d96d86557d434bdf124063e4eec4662067c1e (diff)
feat(std/node): add os.loadavg() (#4075)
Diffstat (limited to 'std/node/os_test.ts')
-rw-r--r--std/node/os_test.ts29
1 files changed, 6 insertions, 23 deletions
diff --git a/std/node/os_test.ts b/std/node/os_test.ts
index f13589a4b..f825ae192 100644
--- a/std/node/os_test.ts
+++ b/std/node/os_test.ts
@@ -1,10 +1,5 @@
const { test } = Deno;
-import {
- assert,
- assertThrows,
- assertEquals,
- AssertionError
-} from "../testing/asserts.ts";
+import { assert, assertThrows, assertEquals } from "../testing/asserts.ts";
import * as os from "./os.ts";
test({
@@ -168,26 +163,14 @@ test({
}
});
-// Method is currently implemented correctly for windows but not for any other os
test({
name: "Load average is an array of 3 numbers",
fn() {
- try {
- const result = os.loadavg();
- assert(result.length == 3);
- assertEquals(typeof result[0], "number");
- assertEquals(typeof result[1], "number");
- assertEquals(typeof result[2], "number");
- } catch (error) {
- if (!(Object.getPrototypeOf(error) === Error.prototype)) {
- const errMsg = `Unexpected error class: ${error.name}`;
- throw new AssertionError(errMsg);
- } else if (!error.message.includes("Not implemented")) {
- throw new AssertionError(
- "Expected this error to contain 'Not implemented'"
- );
- }
- }
+ const result = os.loadavg();
+ assert(result.length == 3);
+ assertEquals(typeof result[0], "number");
+ assertEquals(typeof result[1], "number");
+ assertEquals(typeof result[2], "number");
}
});