Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "a_mock", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "title": "a_mock", |
@@ -1,2 +0,6 @@ | ||
function expectArray(index,mockContext,array) { | ||
yellow = '\u001b[33m', | ||
reset = '\u001b[0m'; | ||
function expectArray(index,mockContext,array) { | ||
console.log('\n%s%s%s', yellow, 'expectArray is deprecated, use expect instead.', reset); | ||
var newHasEqualArgumentArray = require('./newHasEqualArgumentArray'); | ||
@@ -3,0 +7,0 @@ var expectCore = require('./expectCore'); |
@@ -0,4 +1,7 @@ | ||
var isEqualArg = require('./hasSameArgument/isEqualArg'); | ||
function _new(expectedArg,index) { | ||
function hasSameArgument(){ | ||
return arguments[index] === expectedArg; | ||
return arguments.length > index && | ||
isEqualArg(expectedArg,arguments[index]); | ||
} | ||
@@ -5,0 +8,0 @@ |
@@ -5,3 +5,3 @@ var assert = require('assert'); | ||
var newRequireMock = require('../simple/newRequireMock'); | ||
var isEqualArg = newRequireMock('./hasSameArgument/isEqualArg'); | ||
var newSut = require('../newHasSameArgument'); | ||
@@ -19,3 +19,4 @@ | ||
console.log('too few arguments.execute'); | ||
var returned = sut('somearg'); | ||
var arg = {}; | ||
var returned = sut(arg); | ||
@@ -30,3 +31,5 @@ test('it should return false',function() { | ||
console.log('incorrect argument.execute'); | ||
var returned = sut('arg','arg2'); | ||
var arg = {}; | ||
isEqualArg.expect(expectedArg).expect(arg).return(false); | ||
var returned = sut('arg',arg); | ||
@@ -41,4 +44,7 @@ test('it should return false',function() { | ||
console.log('correct argument.execute'); | ||
var returned = sut('arg',expectedArg); | ||
var arg = {}; | ||
isEqualArg.expect(expectedArg).expect(arg).return(true); | ||
var returned = sut('arg',arg); | ||
test('it should return true',function() { | ||
@@ -49,2 +55,31 @@ assert.equal(true,returned); | ||
})(); | ||
/* (function() { | ||
var obj; | ||
obj = []; | ||
for (var property in obj ) { | ||
console.log(property); | ||
}; | ||
obj = {foo: 'hei'}; | ||
for (var property in obj ) { | ||
console.log(property); | ||
}; | ||
var Foo = function() { | ||
this.gag = 'gag'; | ||
this.baz = {}; | ||
} | ||
Foo.prototype.bar = function(){ console.log('hello ' + this.gag);}; | ||
obj = new Foo(); | ||
obj2 = new Foo(); | ||
for (var property in obj ) { | ||
console.log(property); | ||
}; | ||
obj.bar(); | ||
assert.equal(obj.baz,obj2.baz); | ||
*/ | ||
})(); |
@@ -84,3 +84,3 @@ var assert = require('assert'); | ||
var sut = newSut(fallback); | ||
sut.expectArray([element1,element2]).return(expected); | ||
sut.expect([element1,element2]).return(expected); | ||
var returned = sut([element1,element2]); | ||
@@ -302,3 +302,3 @@ var returned2 = sut([element1,element2]); | ||
sut.expectArray([a,b]); | ||
sut.expect([a,b]); | ||
var returned = sut([a,b]); | ||
@@ -305,0 +305,0 @@ var returned2 = sut(); |
110846
110
3558