Skip to content

Commit

Permalink
Merge pull request mochajs#2703 from seppevs/cover_utils_some_fn_with…
Browse files Browse the repository at this point in the history
…_tests

cover .some() function in utils.js with tests
  • Loading branch information
Munter authored Feb 7, 2017
2 parents f42cbf4 + ed61cd0 commit a2fc76c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit a2fc76c

Please sign in to comment.