Added unit tests for main controller using Sinon spies.