diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-06-12 20:23:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 15:23:38 -0400 |
commit | 1fff6f55c3ba98a10018c6d374795e612061e9b6 (patch) | |
tree | 12074b6d44736b11513d857e437f9e30a6bf65a4 /std/node/events_test.ts | |
parent | 26bf56afdaf16634ffbaa23684faf3a44cc10f62 (diff) |
refactor: Don't destructure the Deno namespace (#6268)
Diffstat (limited to 'std/node/events_test.ts')
-rw-r--r-- | std/node/events_test.ts | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/std/node/events_test.ts b/std/node/events_test.ts index 4b47686f4..58025ce84 100644 --- a/std/node/events_test.ts +++ b/std/node/events_test.ts @@ -1,4 +1,3 @@ -const { test } = Deno; import { assert, assertEquals, @@ -11,7 +10,7 @@ const shouldNeverBeEmitted: Function = () => { fail("Should never be called"); }; -test({ +Deno.test({ name: 'When adding a new event, "eventListener" event is fired before adding the listener', fn() { @@ -32,7 +31,7 @@ test({ }, }); -test({ +Deno.test({ name: 'When removing a listenert, "removeListener" event is fired after removal', fn() { @@ -52,7 +51,7 @@ test({ }, }); -test({ +Deno.test({ name: "Default max listeners is 10, but can be changed by direct assignment only", fn() { @@ -65,7 +64,7 @@ test({ }, }); -test({ +Deno.test({ name: "addListener adds a listener, and listener count is correct", fn() { const testEmitter = new EventEmitter(); @@ -76,7 +75,7 @@ test({ }, }); -test({ +Deno.test({ name: "Emitted events are called synchronously in the order they were added", fn() { const testEmitter = new EventEmitter(); @@ -103,7 +102,7 @@ test({ }, }); -test({ +Deno.test({ name: "Registered event names are returned as strings or Sybols", fn() { const testEmitter = new EventEmitter(); @@ -115,7 +114,7 @@ test({ }, }); -test({ +Deno.test({ name: "You can set and get max listeners", fn() { const testEmitter = new EventEmitter(); @@ -125,7 +124,7 @@ test({ }, }); -test({ +Deno.test({ name: "You can retrieve registered functions for an event", fn() { const testEmitter = new EventEmitter(); @@ -140,7 +139,7 @@ test({ }, }); -test({ +Deno.test({ name: "Off is alias for removeListener", fn() { const testEmitter = new EventEmitter(); @@ -151,7 +150,7 @@ test({ }, }); -test({ +Deno.test({ name: "Event registration can be chained", fn() { const testEmitter = new EventEmitter(); @@ -162,7 +161,7 @@ test({ }, }); -test({ +Deno.test({ name: "Events can be registered to only fire once", fn() { let eventsFired: string[] = []; @@ -186,7 +185,7 @@ test({ }, }); -test({ +Deno.test({ name: "You can inject a listener into the start of the stack, rather than at the end", fn() { @@ -206,7 +205,7 @@ test({ }, }); -test({ +Deno.test({ name: 'You can prepend a "once" listener', fn() { const eventsFired: string[] = []; @@ -226,7 +225,7 @@ test({ }, }); -test({ +Deno.test({ name: "Remove all listeners, which can also be chained", fn() { const testEmitter = new EventEmitter(); @@ -245,7 +244,7 @@ test({ }, }); -test({ +Deno.test({ name: "Provide a non-existent event to removeAllListeners will do nothing", fn() { const testEmitter = new EventEmitter(); @@ -264,7 +263,7 @@ test({ }, }); -test({ +Deno.test({ name: "Remove individual listeners, which can also be chained", fn() { const testEmitter = new EventEmitter(); @@ -287,7 +286,7 @@ test({ }, }); -test({ +Deno.test({ name: "It is OK to try to remove non-existent listener", fn() { const testEmitter = new EventEmitter(); @@ -306,7 +305,7 @@ test({ }, }); -test({ +Deno.test({ name: "all listeners complete execution even if removed before execution", fn() { const testEmitter = new EventEmitter(); @@ -329,7 +328,7 @@ test({ }, }); -test({ +Deno.test({ name: 'Raw listener will return event listener or wrapped "once" function', fn() { const testEmitter = new EventEmitter(); @@ -352,7 +351,7 @@ test({ }, }); -test({ +Deno.test({ name: "Once wrapped raw listeners may be executed multiple times, until the wrapper is executed", fn() { @@ -375,7 +374,7 @@ test({ }, }); -test({ +Deno.test({ name: "Can add once event listener to EventEmitter via standalone function", async fn() { const ee = new EventEmitter(); @@ -388,7 +387,7 @@ test({ }, }); -test({ +Deno.test({ name: "Can add once event listener to EventTarget via standalone function", async fn() { const et: EventTarget = new EventTarget(); @@ -402,7 +401,7 @@ test({ }, }); -test({ +Deno.test({ name: "Only valid integers are allowed for max listeners", fn() { const ee = new EventEmitter(); @@ -424,7 +423,7 @@ test({ }, }); -test({ +Deno.test({ name: "ErrorMonitor can spy on error events without consuming them", fn() { const ee = new EventEmitter(); @@ -462,7 +461,7 @@ test({ }, }); -test({ +Deno.test({ name: "asynchronous iteration of events are handled as expected", async fn() { const ee = new EventEmitter(); @@ -490,7 +489,7 @@ test({ }, }); -test({ +Deno.test({ name: "asynchronous error handling of emitted events works as expected", async fn() { const ee = new EventEmitter(); @@ -515,7 +514,7 @@ test({ }, }); -test({ +Deno.test({ name: "error thrown during asynchronous processing of events is handled", async fn() { const ee = new EventEmitter(); @@ -544,7 +543,7 @@ test({ }, }); -test({ +Deno.test({ name: "error thrown in processing loop of asynchronous event prevents processing of additional events", async fn() { @@ -570,7 +569,7 @@ test({ }, }); -test({ +Deno.test({ name: "asynchronous iterator next() works as expected", async fn() { const ee = new EventEmitter(); @@ -610,7 +609,7 @@ test({ }, }); -test({ +Deno.test({ name: "async iterable throw handles various scenarios", async fn() { const ee = new EventEmitter(); |