- What does the code need to do?
- Which type of data my method/code receive? (
String
,Number
,Array
...) - Which type of data method/code returns?
- Which action trigger my method/code?
- "It should
do that
whenthis
."
it('should return 4 when it receives 2,2') {
expect(sum(2,2)).to.equal(4);
}
-
Spies
Watch and verify if a method is called in any file or code block.
-
Stubs
Control test behavior(example: an exeption), skip unecessary part of a code(example: database execution) and simplify asynchronous code test.
-
Mocks
False methods and pre-coded expectations.