From ed61cd0d2bd9313ef5288ca10e8f4e5e294cde1a Mon Sep 17 00:00:00 2001 From: Sebastian Van Sande Date: Tue, 7 Feb 2017 16:32:29 +0100 Subject: [PATCH] cover .some() function in utils.js with tests --- test/utils.spec.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/utils.spec.js b/test/utils.spec.js index 4c5a9ca5c2..2eaf908cd6 100644 --- a/test/utils.spec.js +++ b/test/utils.spec.js @@ -80,6 +80,24 @@ describe('utils', function () { }); }); + describe('.some()', function () { + var some = utils.some; + + it('should return true when some array elements pass the check of the fn parameter', function () { + var result = some(['a', 'b', 'c'], function (e) { + return e === 'b'; + }); + result.should.eql(true); + }); + + it('should return false when none of the array elements pass the check of the fn parameter', function () { + var result = some(['a', 'b', 'c'], function (e) { + return e === 'd'; + }); + result.should.eql(false); + }); + }); + describe('.parseQuery()', function () { var parseQuery = utils.parseQuery; it('should get queryString and return key-value object', function () {