summaryrefslogtreecommitdiff
path: root/includes/external/matrix/node_modules/events/tests/common.js
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
committerRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
commit953ddd82e48dd206cef5ac94456549aed13b3ad5 (patch)
tree8f003106ee2e7f422e5a22d2ee04d0db302e66c0 /includes/external/matrix/node_modules/events/tests/common.js
parent62a9199846b0c07c03218703b33e8385764f42d9 (diff)
downloadpluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.gz
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.bz2
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.zip
Updated 30 files and deleted 2976 files (automated)
Diffstat (limited to 'includes/external/matrix/node_modules/events/tests/common.js')
-rw-r--r--includes/external/matrix/node_modules/events/tests/common.js104
1 files changed, 0 insertions, 104 deletions
diff --git a/includes/external/matrix/node_modules/events/tests/common.js b/includes/external/matrix/node_modules/events/tests/common.js
deleted file mode 100644
index 49569b0..0000000
--- a/includes/external/matrix/node_modules/events/tests/common.js
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var test = require('tape');
-var assert = require('assert');
-
-var noop = function() {};
-
-var mustCallChecks = [];
-
-function runCallChecks(exitCode) {
- if (exitCode !== 0) return;
-
- var failed = filter(mustCallChecks, function(context) {
- if ('minimum' in context) {
- context.messageSegment = 'at least ' + context.minimum;
- return context.actual < context.minimum;
- } else {
- context.messageSegment = 'exactly ' + context.exact;
- return context.actual !== context.exact;
- }
- });
-
- for (var i = 0; i < failed.length; i++) {
- var context = failed[i];
- console.log('Mismatched %s function calls. Expected %s, actual %d.',
- context.name,
- context.messageSegment,
- context.actual);
- // IE8 has no .stack
- if (context.stack) console.log(context.stack.split('\n').slice(2).join('\n'));
- }
-
- assert.strictEqual(failed.length, 0);
-}
-
-exports.mustCall = function(fn, exact) {
- return _mustCallInner(fn, exact, 'exact');
-};
-
-function _mustCallInner(fn, criteria, field) {
- if (typeof criteria == 'undefined') criteria = 1;
-
- if (typeof fn === 'number') {
- criteria = fn;
- fn = noop;
- } else if (fn === undefined) {
- fn = noop;
- }
-
- if (typeof criteria !== 'number')
- throw new TypeError('Invalid ' + field + ' value: ' + criteria);
-
- var context = {
- actual: 0,
- stack: (new Error()).stack,
- name: fn.name || '<anonymous>'
- };
-
- context[field] = criteria;
-
- // add the exit listener only once to avoid listener leak warnings
- if (mustCallChecks.length === 0) test.onFinish(function() { runCallChecks(0); });
-
- mustCallChecks.push(context);
-
- return function() {
- context.actual++;
- return fn.apply(this, arguments);
- };
-}
-
-exports.mustNotCall = function(msg) {
- return function mustNotCall() {
- assert.fail(msg || 'function should not have been called');
- };
-};
-
-function filter(arr, fn) {
- if (arr.filter) return arr.filter(fn);
- var filtered = [];
- for (var i = 0; i < arr.length; i++) {
- if (fn(arr[i], i, arr)) filtered.push(arr[i]);
- }
- return filtered
-}