HTML and CSS Reference
In-Depth Information
* method both return 5
*/
equal(calculator.subtract(5), 5, '10 - 5 should equal 5');
equal(calculator.getResult(), 5, '10 - 5 should equal 5');
});
test('calculator divide', 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 5
*/
equal(calculator.divide(2), 5, '10 / 2 should equal 5');
equal(calculator.getResult(), 5, '10 / 2 should equal 5');
});
test('calculator multiply', 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.multiply(2), 20, '10 * 2 should equal 20');
equal(calculator.getResult(), 20, '10 * 2 should equal 20');
Search WWH ::




Custom Search