Skip to content

Commit

Permalink
Merge branch 'release/0.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
realistschuckle committed Sep 16, 2015
2 parents 63b1bd8 + dd7a728 commit aa513ea
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/nodemock.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function NodeMock(methodName) {
continue;
} else if(actualType == "object") {
if(!deepObjectCheck(expected[key] ,actual[key])) return false;
} else {
} else if (!isNaN(actual[key]) && !isNaN(expected[key])) {
if(actual[key] != expected[key]) return false;
}
}
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"name": "nodemock",
"version": "0.3.4",
"version": "0.3.5",
"directories": {
"test": "test"
},
"main": "./lib/nodemock",
"description": "Simple Yet Powerful Mocking Framework for NodeJs",
"author": "Arunoda Susiripala <arunoda.susiripala@gmail.com>",
"author": "Curtis Schlak <realistschuckle@gmail.com>",
"homepage": "http://curtis.schlak.com/nodemock/",
"contributors": [
"Curtis Schlak <realistschuckle@gmail.com>",
"Oscar Renalias <oscar@renalias.net>",
"Aaron Fay <aaron.j.fay@gmail.com>",
"Dominic Tarr <dominic.tarr@gmail.com>",
Expand All @@ -26,10 +25,10 @@
}
],
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.3.0",
"grunt-contrib-nodeunit": "~0.1.2",
"nodeunit": "~0.7.4"
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.11.3",
"grunt-contrib-nodeunit": "^0.4.1",
"nodeunit": "^0.9.1"
},
"repository": {
"type": "git",
Expand All @@ -52,5 +51,5 @@
"nodemock",
"mockingbird"
],
"license": "MIT-License"
"license": "MIT"
}
33 changes: 22 additions & 11 deletions test/nodemock.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,61 +42,72 @@ exports['mocks can have names which get reported in error messages'] = function(
exports['mocked functions pattern match on'] = {
setUp: function(cb) {
this.mock = nm.mock('foo')
.takes(10, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
.takes(10, NaN, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
cb();
}

, numbers: function(test) {
var mock = this.mock;
test.doesNotThrow(function() {
mock.foo(10, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
mock.foo(10, NaN, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.throws(function() {
mock.foo(-1, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
mock.foo(-1, NaN, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.done();
}

, 'silly numbers': function(test) {
var mock = this.mock;
test.doesNotThrow(function() {
mock.foo(10, NaN, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.throws(function() {
mock.foo(10, 3, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.done();
}

, strings: function(test) {
var mock = this.mock;
test.doesNotThrow(function() {
mock.foo(10, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
mock.foo(10, NaN, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.throws(function() {
mock.foo(10, "WORLD", true, [1, 4, 5], {"a": "aa", "b": "bb"});
mock.foo(10, NaN, "WORLD", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.done();
}

, booleans: function(test) {
var mock = this.mock;
test.doesNotThrow(function() {
mock.foo(10, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
mock.foo(10, NaN, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.throws(function() {
mock.foo(10, "Hello", false, [1, 4, 5], {"a": "aa", "b": "bb"});
mock.foo(10, NaN, "Hello", false, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.done();
}

, arrays: function(test) {
var mock = this.mock;
test.doesNotThrow(function() {
mock.foo(10, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
mock.foo(10, NaN, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.throws(function() {
mock.foo(10, "Hello", true, [1, 5, 4], {"a": "aa", "b": "bb"});
mock.foo(10, NaN, "Hello", true, [1, 5, 4], {"a": "aa", "b": "bb"});
});
test.done();
}

, objects: function(test) {
var mock = this.mock;
test.doesNotThrow(function() {
mock.foo(10, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
mock.foo(10, NaN, "Hello", true, [1, 4, 5], {"a": "aa", "b": "bb"});
});
test.throws(function() {
mock.foo(10, "Hello", true, [1, 4, 5], {"c": "aa", "b": "aa"});
mock.foo(10, NaN, "Hello", true, [1, 4, 5], {"c": "aa", "b": "aa"});
});
test.done();
}
Expand Down

0 comments on commit aa513ea

Please sign in to comment.