Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

cover .some() function in utils.js with tests

Sebastian Van Sandeed61cd0d2bd9
diff --git a/test/utils.spec.js b/test/utils.spec.js
index 4c5a9ca5..2eaf908c 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 () {