-
-
Save bbraithwaite/376bb62af8b003b94fdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var calculator = { | |
sum: function (x, y) { | |
return x + y; | |
}, | |
subtract: function (x, y) { | |
return x - y; | |
}, | |
divide: function (x, y) { | |
return (y === 0) ? 0 : x / y; | |
} | |
} | |
describe('calculator', function () { | |
describe('sum', function () { | |
it('1 + 1 should equal 2', function () { | |
expect(calculator.sum(1, 1)).toBe(2); | |
}); | |
}); | |
describe('subtract', function () { | |
it('3 - 2 should equal 1', function () { | |
expect(calculator.subtract(3, 2)).toBe(1); | |
}); | |
}); | |
describe('divide', function () { | |
it('10 / 5 should equal 2', function () { | |
expect(calculator.divide(10, 5)).toBe(2); | |
}); | |
it('zero divisor should equal 0', function () { | |
expect(calculator.divide(10, 0)).toBe(0); | |
}); | |
}); | |
}); |
Thank you for great starting tutorial, now on to the next.
Excellent didactic! Thank you for this light!
Thank you 👍
Thanks a lot. This was really helpful to start the journey.
awesome tut man!
Thank you for this introductory tutorial. Helped a lot for me.
Such an awesome tutorial dude, really concise and everything! Thanks heaps! :)
Really Helps. Thanks for this getting started tutorial.
great tutorial to start with!
Really helped. keep up the good work
Could someone tell me how to test this block? In typescript and angular 2. In short, I would like to know how to access and set a function's local variables like in this case.
test(): any {
var value = 2;
if(value === 2){
return true;
}else{
return false;
}
}
nicely explained ...!
thank you 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for you tutorial. At least and last came to know how exactly it works !