HTML and CSS Reference
In-Depth Information
*/
var calculator = new app.calculator(10);
/**
* You then assert that 10 is being held as the current result
*/
equal(calculator.getResult(), 10, 'the result should equal 10 with no
operation');
});
test('calculator add', function(){
/**
* Specify how many assertions this test will run.
* If assertions do not run for any reason, this
* test will fail
*/
expect(2);
/**
* Create a new calculator instance and set the initial value to 10
*/
var calculator = new app.calculator(10);
/**
* Assert that both the return value of the operation and the getResult
* method both return 20
*/
equal(calculator.add(10), 20, '10 + 10 should equal 20');
equal(calculator.getResult(), 20, '10 + 10 should result in 20');
});
test('calculator subtract', function(){
/**
* Specify how many assertions this test will run.
* If assertions do not run for any reason, this
* test will fail
*/
expect(2);
/**
* Create a new calculator instance and set the initial value to 10
*/
var calculator = new app.calculator(10);
/**
* Assert that both the return value of the operation and the getResult
Search WWH ::




Custom Search