5 Questions Every Unit Test Must Answer
Eric Elliott
2.7K30

Since I write tests with jasmine, I will just leave this here:

Having only actual/expected is not descriptive enough.
If I have 10 tests all I will see at the bottom
//expect(actual).toBe(expected);

So what do you think of the following piece of code?

describe(‘Compose’, function(){

it(‘should return a function’,function(){

var returnedValue = typeof compose(); var functionType = ‘function’;

expect(returnedValue).toBe(functionType); })

}

Actually expect(typeof compose()).toBe(‘function’) reads far better than expect(actual).toBe(expected);

Everything should have a clear meaning and show read like a sentence.
This expected/actual is like var a,b; to me.