summaryrefslogtreecommitdiff
path: root/cli/js/event_target_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-03-04 17:31:14 +0100
committerGitHub <noreply@github.com>2020-03-04 17:31:14 +0100
commit8d96dffa410a149d0fff6115bd97f41fc1fe7459 (patch)
treeb00dc7a78e5030b68741de8bf9dde83b9fa07364 /cli/js/event_target_test.ts
parent30682cf74fa039d3493c74101dca2dbb3a8d49b6 (diff)
refactor: rewrite testPerm into unitTest (#4231)
Rewrite "testPerm" helper function used for testing of internal runtime code. It's been renamed to "unitTest" and provides API that is extensible in the future by accepting optional "UnitTestOptions" argument. "test" helper was also removed and replaced by overloaded version of "unitTest" that takes only function argument. "UnitTestOptions" currently supports "perms" and "skip" options, where former works exactly as first argument to "testPerm" did, while the latter allows to conditionally skip tests.
Diffstat (limited to 'cli/js/event_target_test.ts')
-rw-r--r--cli/js/event_target_test.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/cli/js/event_target_test.ts b/cli/js/event_target_test.ts
index 34d42d014..af7895081 100644
--- a/cli/js/event_target_test.ts
+++ b/cli/js/event_target_test.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { test, assertEquals } from "./test_util.ts";
+import { unitTest, assertEquals } from "./test_util.ts";
-test(function addEventListenerTest(): void {
+unitTest(function addEventListenerTest(): void {
const document = new EventTarget();
// @ts-ignore tests ignoring the type system for resilience
@@ -12,7 +12,7 @@ test(function addEventListenerTest(): void {
assertEquals(document.addEventListener("x", null), undefined);
});
-test(function constructedEventTargetCanBeUsedAsExpected(): void {
+unitTest(function constructedEventTargetCanBeUsedAsExpected(): void {
const target = new EventTarget();
const event = new Event("foo", { bubbles: true, cancelable: false });
let callCount = 0;
@@ -35,7 +35,7 @@ test(function constructedEventTargetCanBeUsedAsExpected(): void {
assertEquals(callCount, 2);
});
-test(function anEventTargetCanBeSubclassed(): void {
+unitTest(function anEventTargetCanBeSubclassed(): void {
class NicerEventTarget extends EventTarget {
on(
type: string,
@@ -69,7 +69,7 @@ test(function anEventTargetCanBeSubclassed(): void {
assertEquals(callCount, 0);
});
-test(function removingNullEventListenerShouldSucceed(): void {
+unitTest(function removingNullEventListenerShouldSucceed(): void {
const document = new EventTarget();
// @ts-ignore
assertEquals(document.removeEventListener("x", null, false), undefined);
@@ -79,7 +79,7 @@ test(function removingNullEventListenerShouldSucceed(): void {
assertEquals(document.removeEventListener("x", null), undefined);
});
-test(function constructedEventTargetUseObjectPrototype(): void {
+unitTest(function constructedEventTargetUseObjectPrototype(): void {
const target = new EventTarget();
const event = new Event("toString", { bubbles: true, cancelable: false });
let callCount = 0;
@@ -102,12 +102,12 @@ test(function constructedEventTargetUseObjectPrototype(): void {
assertEquals(callCount, 2);
});
-test(function toStringShouldBeWebCompatible(): void {
+unitTest(function toStringShouldBeWebCompatible(): void {
const target = new EventTarget();
assertEquals(target.toString(), "[object EventTarget]");
});
-test(function dispatchEventShouldNotThrowError(): void {
+unitTest(function dispatchEventShouldNotThrowError(): void {
let hasThrown = false;
try {
@@ -126,7 +126,7 @@ test(function dispatchEventShouldNotThrowError(): void {
assertEquals(hasThrown, false);
});
-test(function eventTargetThisShouldDefaultToWindow(): void {
+unitTest(function eventTargetThisShouldDefaultToWindow(): void {
const {
addEventListener,
dispatchEvent,