Permalink
Browse files

Add a negative test case.

  • Loading branch information...
1 parent c5d1858 commit 04390dbd3e480bb83250047907f33e8626f065ec @Kami Kami committed Dec 2, 2012
Showing with 16 additions and 5 deletions.
  1. +16 −5 example/test-spyon.js
View
@@ -64,7 +64,7 @@ exports['test_spyon_returns_right'] = function(test, assert) {
test.finish();
};
-exports['test_spyon_count_correct'] = function (test, assert) {
+exports['test_spyon_count_correct'] = function(test, assert) {
var foo = new Foo();
test.spy.on('setFoo', foo);
foo.setFoo();
@@ -79,7 +79,7 @@ exports['test_spyon_count_correct'] = function (test, assert) {
test.finish();
};
-exports['test_spyon_with_arguments_correct'] = function (test, assert) {
+exports['test_spyon_with_arguments_correct'] = function(test, assert) {
var foo, arr;
foo = new Foo();
arr = ['a', 'b', null];
@@ -90,7 +90,18 @@ exports['test_spyon_with_arguments_correct'] = function (test, assert) {
test.finish();
};
-exports['test_spyon_accepts_function'] = function (test, assert) {
+exports['test_spyon_with_arguments_incorrect'] = function(test, assert) {
+ var foo, arr;
+ foo = new Foo();
+ arr = ['a', 'b', null];
+ test.spy.on('setBar', foo);
+ foo.setBar(['c']);
+ assert.ok(!test.spy.called('setBar').with(arr));
+ test.spy.clear('setBar', foo);
+ test.finish();
+};
+
+exports['test_spyon_accepts_function'] = function(test, assert) {
var foo, func, set;
foo = new Foo();
set = false;
@@ -104,7 +115,7 @@ exports['test_spyon_accepts_function'] = function (test, assert) {
test.finish();
};
-exports['test_spyon_reapplies_original_function'] = function (test, assert) {
+exports['test_spyon_reapplies_original_function'] = function(test, assert) {
var foo, func;
foo = new Foo();
func = foo.setFoo;
@@ -114,7 +125,7 @@ exports['test_spyon_reapplies_original_function'] = function (test, assert) {
test.finish();
};
-exports['test_spyon_reapplies_given_function'] = function (test, assert) {
+exports['test_spyon_reapplies_given_function'] = function(test, assert) {
var foo, func, set;
foo = new Foo();
set = false;

0 comments on commit 04390db

Please sign in to comment.