chai pr 1085

node v8.17.0
version: master
endpointsharetweet
const chai= require("chai"); const assert= chai.assert; var myObj= { value: 2 }; function increaseObjectValue() { myObj.value+= 10; } function decreaseObjectValue() { myObj.value-= 5; } function getTheObject() { return myObj; } function getTheValue() { return myObj.value; } assert.changes(increaseObjectValue, myObj, 'value'); // assert.changes(increaseObjectValue, getTheObject, 'value');// fail value: expected [object Object] to change assert.changes(increaseObjectValue, getTheValue); assert.changesBy(decreaseObjectValue, myObj, 'value', 5); // assert.changesBy(decreaseObjectValue, getTheObject, 'value', 5);// fail 5: expected [Function: getTheObject] to have property 'value' // assert.changesBy(decreaseObjectValue, getTheValue, 'value', 5);// fail expecting value // assert.changesBy(decreaseObjectValue, getTheValue, null, 5);// 5: expected 17 to change by null // assert.changesBy(decreaseObjectValue, getTheValue, undefined, 5);// 5: expected 17 to change by undefined assert.changesBy(decreaseObjectValue, getTheValue, 5); // lucas on 1090 // function myBook() {}; // myBook.value = 10 // function lowerValue() { // myBook.value -= 1 // } // assert.decreasesBy(lowerValue, myBook, 'value', 1);
Loading…

no comments

    sign in to comment