diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/event-emitter/test | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/event-emitter/test')
-rw-r--r-- | node_modules/event-emitter/test/all-off.js | 48 | ||||
-rw-r--r-- | node_modules/event-emitter/test/emit-error.js | 14 | ||||
-rw-r--r-- | node_modules/event-emitter/test/has-listeners.js | 42 | ||||
-rw-r--r-- | node_modules/event-emitter/test/index.js | 107 | ||||
-rw-r--r-- | node_modules/event-emitter/test/pipe.js | 53 | ||||
-rw-r--r-- | node_modules/event-emitter/test/unify.js | 123 |
6 files changed, 0 insertions, 387 deletions
diff --git a/node_modules/event-emitter/test/all-off.js b/node_modules/event-emitter/test/all-off.js deleted file mode 100644 index 8aa872e9c..000000000 --- a/node_modules/event-emitter/test/all-off.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -var ee = require('../'); - -module.exports = function (t, a) { - var x, count, count2; - - x = ee(); - count = 0; - count2 = 0; - x.on('foo', function () { - ++count; - }); - x.on('foo', function () { - ++count; - }); - x.on('bar', function () { - ++count2; - }); - x.on('bar', function () { - ++count2; - }); - t(x, 'foo'); - x.emit('foo'); - x.emit('bar'); - a(count, 0, "All off: type"); - a(count2, 2, "All off: ohter type"); - - count = 0; - count2 = 0; - x.on('foo', function () { - ++count; - }); - x.on('foo', function () { - ++count; - }); - x.on('bar', function () { - ++count2; - }); - x.on('bar', function () { - ++count2; - }); - t(x); - x.emit('foo'); - x.emit('bar'); - a(count, 0, "All off: type"); - a(count2, 0, "All off: other type"); -}; diff --git a/node_modules/event-emitter/test/emit-error.js b/node_modules/event-emitter/test/emit-error.js deleted file mode 100644 index edac350af..000000000 --- a/node_modules/event-emitter/test/emit-error.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -var customError = require('es5-ext/error/custom') - , ee = require('../'); - -module.exports = function (t, a) { - var x, error = customError('Some error', 'ERROR_TEST'), emitted; - - x = ee(); - a.throws(function () { t.call(x, error); }, 'ERROR_TEST'); - x.on('error', function (err) { emitted = err; }); - t.call(x, error); - a(emitted, error); -}; diff --git a/node_modules/event-emitter/test/has-listeners.js b/node_modules/event-emitter/test/has-listeners.js deleted file mode 100644 index 875b048a4..000000000 --- a/node_modules/event-emitter/test/has-listeners.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -var ee = require('../'); - -module.exports = function (t) { - var x, y; - return { - Any: function (a) { - a(t(true), false, "Primitive"); - a(t({ events: [] }), false, "Other object"); - a(t(x = ee()), false, "Emitter: empty"); - - x.on('test', y = function () {}); - a(t(x), true, "Emitter: full"); - x.off('test', y); - a(t(x), false, "Emitter: empty but touched"); - x.once('test', y = function () {}); - a(t(x), true, "Emitter: full: Once"); - x.off('test', y); - a(t(x), false, "Emitter: empty but touched by once"); - }, - Specific: function (a) { - a(t(true, 'test'), false, "Primitive"); - a(t({ events: [] }, 'test'), false, "Other object"); - a(t(x = ee(), 'test'), false, "Emitter: empty"); - - x.on('test', y = function () {}); - a(t(x, 'test'), true, "Emitter: full"); - a(t(x, 'foo'), false, "Emitter: full, other event"); - x.off('test', y); - a(t(x, 'test'), false, "Emitter: empty but touched"); - a(t(x, 'foo'), false, "Emitter: empty but touched, other event"); - - x.once('test', y = function () {}); - a(t(x, 'test'), true, "Emitter: full: Once"); - a(t(x, 'foo'), false, "Emitter: full: Once, other event"); - x.off('test', y); - a(t(x, 'test'), false, "Emitter: empty but touched by once"); - a(t(x, 'foo'), false, "Emitter: empty but touched by once, other event"); - } - }; -}; diff --git a/node_modules/event-emitter/test/index.js b/node_modules/event-emitter/test/index.js deleted file mode 100644 index c7c3f24c4..000000000 --- a/node_modules/event-emitter/test/index.js +++ /dev/null @@ -1,107 +0,0 @@ -'use strict'; - -module.exports = function (t, a) { - var x = t(), y, count, count2, count3, count4, test, listener1, listener2; - - x.emit('none'); - - test = "Once: "; - count = 0; - x.once('foo', function (a1, a2, a3) { - a(this, x, test + "Context"); - a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); - ++count; - }); - - x.emit('foobar'); - a(count, 0, test + "Not invoked on other event"); - x.emit('foo', 'foo', x, 15); - a(count, 1, test + "Emitted"); - x.emit('foo'); - a(count, 1, test + "Emitted once"); - - test = "On & Once: "; - count = 0; - x.on('foo', listener1 = function (a1, a2, a3) { - a(this, x, test + "Context"); - a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); - ++count; - }); - count2 = 0; - x.once('foo', listener2 = function (a1, a2, a3) { - a(this, x, test + "Context"); - a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); - ++count2; - }); - - x.emit('foobar'); - a(count, 0, test + "Not invoked on other event"); - x.emit('foo', 'foo', x, 15); - a(count, 1, test + "Emitted"); - x.emit('foo', 'foo', x, 15); - a(count, 2, test + "Emitted twice"); - a(count2, 1, test + "Emitted once"); - x.off('foo', listener1); - x.emit('foo'); - a(count, 2, test + "Not emitter after off"); - - count = 0; - x.once('foo', listener1 = function () { ++count; }); - - x.off('foo', listener1); - x.emit('foo'); - a(count, 0, "Once Off: Not emitted"); - - count = 0; - x.on('foo', listener2 = function () {}); - x.once('foo', listener1 = function () { ++count; }); - - x.off('foo', listener1); - x.emit('foo'); - a(count, 0, "Once Off (multi): Not emitted"); - x.off('foo', listener2); - - test = "Prototype Share: "; - - y = Object.create(x); - - count = 0; - count2 = 0; - count3 = 0; - count4 = 0; - x.on('foo', function () { - ++count; - }); - y.on('foo', function () { - ++count2; - }); - x.once('foo', function () { - ++count3; - }); - y.once('foo', function () { - ++count4; - }); - x.emit('foo'); - a(count, 1, test + "x on count"); - a(count2, 0, test + "y on count"); - a(count3, 1, test + "x once count"); - a(count4, 0, test + "y once count"); - - y.emit('foo'); - a(count, 1, test + "x on count"); - a(count2, 1, test + "y on count"); - a(count3, 1, test + "x once count"); - a(count4, 1, test + "y once count"); - - x.emit('foo'); - a(count, 2, test + "x on count"); - a(count2, 1, test + "y on count"); - a(count3, 1, test + "x once count"); - a(count4, 1, test + "y once count"); - - y.emit('foo'); - a(count, 2, test + "x on count"); - a(count2, 2, test + "y on count"); - a(count3, 1, test + "x once count"); - a(count4, 1, test + "y once count"); -}; diff --git a/node_modules/event-emitter/test/pipe.js b/node_modules/event-emitter/test/pipe.js deleted file mode 100644 index 9d15d6dae..000000000 --- a/node_modules/event-emitter/test/pipe.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -var ee = require('../'); - -module.exports = function (t, a) { - var x = {}, y = {}, z = {}, count, count2, count3, pipe; - - ee(x); - x = Object.create(x); - ee(y); - ee(z); - - count = 0; - count2 = 0; - count3 = 0; - x.on('foo', function () { - ++count; - }); - y.on('foo', function () { - ++count2; - }); - z.on('foo', function () { - ++count3; - }); - - x.emit('foo'); - a(count, 1, "Pre pipe, x"); - a(count2, 0, "Pre pipe, y"); - a(count3, 0, "Pre pipe, z"); - - pipe = t(x, y); - x.emit('foo'); - a(count, 2, "Post pipe, x"); - a(count2, 1, "Post pipe, y"); - a(count3, 0, "Post pipe, z"); - - y.emit('foo'); - a(count, 2, "Post pipe, on y, x"); - a(count2, 2, "Post pipe, on y, y"); - a(count3, 0, "Post pipe, on y, z"); - - t(x, z); - x.emit('foo'); - a(count, 3, "Post pipe z, x"); - a(count2, 3, "Post pipe z, y"); - a(count3, 1, "Post pipe z, z"); - - pipe.close(); - x.emit('foo'); - a(count, 4, "Close pipe y, x"); - a(count2, 3, "Close pipe y, y"); - a(count3, 2, "Close pipe y, z"); -}; diff --git a/node_modules/event-emitter/test/unify.js b/node_modules/event-emitter/test/unify.js deleted file mode 100644 index 69295e065..000000000 --- a/node_modules/event-emitter/test/unify.js +++ /dev/null @@ -1,123 +0,0 @@ -'use strict'; - -var ee = require('../'); - -module.exports = function (t) { - - return { - "": function (a) { - var x = {}, y = {}, z = {}, count, count2, count3; - - ee(x); - ee(y); - ee(z); - - count = 0; - count2 = 0; - count3 = 0; - x.on('foo', function () { ++count; }); - y.on('foo', function () { ++count2; }); - z.on('foo', function () { ++count3; }); - - x.emit('foo'); - a(count, 1, "Pre unify, x"); - a(count2, 0, "Pre unify, y"); - a(count3, 0, "Pre unify, z"); - - t(x, y); - a(x.__ee__, y.__ee__, "Post unify y"); - x.emit('foo'); - a(count, 2, "Post unify, x"); - a(count2, 1, "Post unify, y"); - a(count3, 0, "Post unify, z"); - - y.emit('foo'); - a(count, 3, "Post unify, on y, x"); - a(count2, 2, "Post unify, on y, y"); - a(count3, 0, "Post unify, on y, z"); - - t(x, z); - a(x.__ee__, x.__ee__, "Post unify z"); - x.emit('foo'); - a(count, 4, "Post unify z, x"); - a(count2, 3, "Post unify z, y"); - a(count3, 1, "Post unify z, z"); - }, - "On empty": function (a) { - var x = {}, y = {}, z = {}, count, count2, count3; - - ee(x); - ee(y); - ee(z); - - count = 0; - count2 = 0; - count3 = 0; - y.on('foo', function () { ++count2; }); - x.emit('foo'); - a(count, 0, "Pre unify, x"); - a(count2, 0, "Pre unify, y"); - a(count3, 0, "Pre unify, z"); - - t(x, y); - a(x.__ee__, y.__ee__, "Post unify y"); - x.on('foo', function () { ++count; }); - x.emit('foo'); - a(count, 1, "Post unify, x"); - a(count2, 1, "Post unify, y"); - a(count3, 0, "Post unify, z"); - - y.emit('foo'); - a(count, 2, "Post unify, on y, x"); - a(count2, 2, "Post unify, on y, y"); - a(count3, 0, "Post unify, on y, z"); - - t(x, z); - a(x.__ee__, z.__ee__, "Post unify z"); - z.on('foo', function () { ++count3; }); - x.emit('foo'); - a(count, 3, "Post unify z, x"); - a(count2, 3, "Post unify z, y"); - a(count3, 1, "Post unify z, z"); - }, - Many: function (a) { - var x = {}, y = {}, z = {}, count, count2, count3; - - ee(x); - ee(y); - ee(z); - - count = 0; - count2 = 0; - count3 = 0; - x.on('foo', function () { ++count; }); - y.on('foo', function () { ++count2; }); - y.on('foo', function () { ++count2; }); - z.on('foo', function () { ++count3; }); - - x.emit('foo'); - a(count, 1, "Pre unify, x"); - a(count2, 0, "Pre unify, y"); - a(count3, 0, "Pre unify, z"); - - t(x, y); - a(x.__ee__, y.__ee__, "Post unify y"); - x.emit('foo'); - a(count, 2, "Post unify, x"); - a(count2, 2, "Post unify, y"); - a(count3, 0, "Post unify, z"); - - y.emit('foo'); - a(count, 3, "Post unify, on y, x"); - a(count2, 4, "Post unify, on y, y"); - a(count3, 0, "Post unify, on y, z"); - - t(x, z); - a(x.__ee__, x.__ee__, "Post unify z"); - x.emit('foo'); - a(count, 4, "Post unify z, x"); - a(count2, 6, "Post unify z, y"); - a(count3, 1, "Post unify z, z"); - } - }; -}; |