From 2b325e844f60a0aff53b0e50152efebcc428cf0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Sun, 21 Jan 2024 20:35:21 +0100 Subject: [PATCH] Remove `.is{FunctionType}` assert interfaces --- lib/chai/interface/assert.js | 32 ---------------------------- test/assert.js | 41 ------------------------------------ 2 files changed, 73 deletions(-) diff --git a/lib/chai/interface/assert.js b/lib/chai/interface/assert.js index 21844c20..24ceff36 100644 --- a/lib/chai/interface/assert.js +++ b/lib/chai/interface/assert.js @@ -589,38 +589,6 @@ assert.isNotCallable = function (val, msg) { new Assertion(val, msg, assert.isNotCallable, true).is.not.callable; }; -/** - * ### .isAsyncFunction(value, [message]) - * - * Asserts that `value` is an async function. - * - * async function serveTea() { return 'cup of tea'; }; - * assert.isAsyncFunction(serveTea, 'great, we can have tea now'); - * - * @name isAsyncFunction - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ -assert.isAsyncFunction = function (val, msg) { - new Assertion(val, msg, assert.isAsyncFunction, true).is.a('asyncFunction'); -}; - -/** - * TODO - */ -assert.isGeneratorFunction = function(val, msg) { - new Assertion(val, msg, assert.isGeneratorFunction, true).is.a('generatorFunction'); -} - -/** - * TODO - */ -assert.isAsyncGeneratorFunction = function(val, msg) { - new Assertion(val, msg, assert.isAsyncGeneratorFunction, true).is.a('asyncGeneratorFunction'); -} - /** * ### .isObject(value, [message]) * diff --git a/test/assert.js b/test/assert.js index 0ee95f7e..912aa18f 100644 --- a/test/assert.js +++ b/test/assert.js @@ -548,47 +548,6 @@ describe('assert', function () { }, "blah: expected {} to be a callable function"); }); - it('isAsyncFunction', function() { - var func = async function() {}; - assert.isAsyncFunction(func); - - var func = async function*() {}; - assert.isAsyncFunction(func); - - err(function () { - assert.isAsyncFunction(function() {}, 'blah'); - }, "blah: expected [Function] to be an asyncfunction"); - }); - - it('isGeneratorFunction', function() { - var func = function* () {} - assert.isGeneratorFunction(func) - - var func = async function* () {} - assert.isGeneratorFunction(func) - - err(function () { - assert.isGeneratorFunction(function() {}, 'blah'); - }, "blah: expected [Function] to be a generatorfunction"); - }) - - it('isAsyncGeneratorFunction', function() { - var func = async function* () {} - assert.isAsyncGeneratorFunction(func) - - err(function () { - assert.isAsyncGeneratorFunction(function() {}, 'blah'); - }, "blah: expected [Function] to be an asyncgeneratorfunction"); - - err(function () { - assert.isAsyncGeneratorFunction(async function() {}, 'blah'); - }, "blah: expected [AsyncFunction] to be an asyncgeneratorfunction"); - - err(function () { - assert.isAsyncGeneratorFunction(function*() {}, 'blah'); - }, "blah: expected [GeneratorFunction] to be an asyncgeneratorfunction"); - }) - it('isNotFunction', function () { assert.isNotFunction(5);