From 2120a8766438ed893f7b7400f0590f5094d13abd Mon Sep 17 00:00:00 2001 From: Dan Rouse Date: Fri, 4 Nov 2022 18:21:34 -0500 Subject: [PATCH 1/2] expand array literal test to include all whitespace --- lib/helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 7bc2400..e8332ea 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -23,8 +23,8 @@ var noForLoops = function(func) { var noNewArrays = function(func) { var stringified = func.toString(); - it('should not create new arrays', function() { - expect(stringified.includes(('[]' || '[ ]'))).to.equal(false); + it('should not create new array literals', function() { + expect(stringified).not.to.match(/\[\s+\]/); }); } From 12cfe3f69eb6737db37f769c472e08ecd40f3b19 Mon Sep 17 00:00:00 2001 From: Dan Rouse Date: Fri, 4 Nov 2022 18:22:21 -0500 Subject: [PATCH 2/2] add upperCaseFruits assertions to handle undefined values --- spec.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec.js b/spec.js index c24a5e4..62dc685 100644 --- a/spec.js +++ b/spec.js @@ -346,6 +346,13 @@ var data = upperCaseFruits(testFruits); expect(data).to.not.eql(testFruits); }); + it('should return an array of strings', function () { + var data = upperCaseFruits(testFruits); + expect(Array.isArray(data), 'returned value should be an array').to.be.true; + _.each(data, function (fruit) { + expect(fruit).to.be.a('string'); + }); + }); it('should return an array with all strings converted to uppercase', function () { var data = upperCaseFruits(testFruits); var allUpperCase = true;