fdfd
by dcardoso
JavaScript
/*
This sample js snippet shows how to run a simple jasmine test inside jsFiddle.
To make your tests pass, just comment out the line 15, uncomment the line 16 and press ctrl-enter to run the test.
For more info check: http://opensas.wordpress.com/2013/06/23/sharing-you-javascript-ninja-secrets-run-your-jasmine-tests-on-jsfiddle/
*/
/*
Assignment: implement the calculator.sum method so that it takes two parameters and returns the sum of them.
*/
// source code
var calculator = {
sum: NOT_IMPLEMENTED
// sum: function(a, b) { return a + b; }
};
// specs code
describe("calculator", function() {
it("sum method should be implemented", function() {
expect(calculator.sum).toBeDefined();
});
it("sum method should sum values", function() {
expect(calculator.sum(1,2)).toEqual(3);
});
});
var NOT_IMPLEMENTED = undefined;
// load jasmine htmlReporter
(function() {
var env = jasmine.getEnv();
env.addReporter(new jasmine.HtmlReporter());
env.execute();
}());