Skip to content

Commit

Permalink
updated tests for filterWith and mapWith
Browse files Browse the repository at this point in the history
  • Loading branch information
ascartabelli committed Jul 8, 2016
1 parent 0d992c6 commit a95311d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/lamb.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @overview lamb - A lightweight, and docile, JavaScript library to help embracing functional programming.
* @author Andrea Scartabelli <andrea.scartabelli@gmail.com>
* @version 0.33.0-alpha.6
* @version 0.33.0-alpha.7
* @module lamb
* @license MIT
* @preserve
Expand All @@ -18,7 +18,7 @@
* @category Core
* @type String
*/
lamb._version = "0.33.0-alpha.6";
lamb._version = "0.33.0-alpha.7";

// alias used as a placeholder argument for partial application
var _ = lamb;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"coveralls": "gulp coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"tonicExample": "var _ = require('lamb');",
"version": "0.33.0-alpha.6",
"version": "0.33.0-alpha.7",
"devDependencies": {
"coveralls": "^2.11.9",
"gulp": "^3.9.1",
Expand Down
16 changes: 14 additions & 2 deletions test/spec/arraySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ describe("lamb.array", function () {
expect(getLowerCaseEls("fooBAR")).toEqual(["f", "o", "o"]);
});

it("should throw an exception if the predicate isn't a function or is missing", function () {
["foo", null, void 0, {}, [], /foo/, 1, NaN, true, new Date()].forEach(function (value) {
expect(function () { lamb.filterWith(value)(arr); }).toThrow();
});

expect(function () { lamb.filterWith()(arr); }).toThrow();
});

it("should throw an exception if called without the data argument", function () {
expect(getLowerCaseEls).toThrow();
});
Expand Down Expand Up @@ -668,8 +676,12 @@ describe("lamb.array", function () {
expect(makeDoubles("12345")).toEqual([2, 4, 6, 8, 10]);
});

it("should throw an exception if isn't supplied with a mapping function", function () {
expect(function () { lamb.mapWith(null)(nummbers); }).toThrow();
it("should throw an exception if the iteratee isn't a function or is missing", function () {
["foo", null, void 0, {}, [], /foo/, 1, NaN, true, new Date()].forEach(function (value) {
expect(function () { lamb.mapWith(value)(numbers); }).toThrow();
});

expect(function () { lamb.mapWith()(numbers); }).toThrow();
});

it("should throw an exception if called without the data argument", function () {
Expand Down

0 comments on commit a95311d

Please sign in to comment.