Skip to content

Commit a2fc76c

Browse files
authored
Merge pull request #2703 from seppevs/cover_utils_some_fn_with_tests
cover .some() function in utils.js with tests
2 parents f42cbf4 + ed61cd0 commit a2fc76c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/utils.spec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,24 @@ describe('utils', function () {
8080
});
8181
});
8282

83+
describe('.some()', function () {
84+
var some = utils.some;
85+
86+
it('should return true when some array elements pass the check of the fn parameter', function () {
87+
var result = some(['a', 'b', 'c'], function (e) {
88+
return e === 'b';
89+
});
90+
result.should.eql(true);
91+
});
92+
93+
it('should return false when none of the array elements pass the check of the fn parameter', function () {
94+
var result = some(['a', 'b', 'c'], function (e) {
95+
return e === 'd';
96+
});
97+
result.should.eql(false);
98+
});
99+
});
100+
83101
describe('.parseQuery()', function () {
84102
var parseQuery = utils.parseQuery;
85103
it('should get queryString and return key-value object', function () {

0 commit comments

Comments
 (0)