/
perf_hooks_test.ts
38 lines (35 loc) · 1.16 KB
/
perf_hooks_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import * as perfHooks from "./perf_hooks.ts";
import { performance } from "./perf_hooks.ts";
import { assertEquals } from "../testing/asserts.ts";
Deno.test({
name: "[perf_hooks] performance",
fn() {
assertEquals(perfHooks.performance.measure, performance.measure);
assertEquals(perfHooks.performance.clearMarks, performance.clearMarks);
assertEquals(perfHooks.performance.mark, performance.mark);
assertEquals(perfHooks.performance.now, performance.now);
assertEquals(perfHooks.performance.toJSON, performance.toJSON);
perfHooks.performance.measure("test");
perfHooks.performance.mark("test");
perfHooks.performance.clearMarks("test");
perfHooks.performance.now();
perfHooks.performance.toJSON();
},
});
Deno.test({
name: "[perf_hooks] performance destructured",
fn() {
performance.measure("test");
performance.mark("test");
performance.clearMarks("test");
performance.now();
performance.toJSON();
},
});
Deno.test({
name: "[perf_hooks] PerformanceEntry",
fn() {
assertEquals(perfHooks.PerformanceEntry, PerformanceEntry);
},
});