what and how to do unit test for angular factories
<p>Angular factory is great!! While writing unit test, it is kind of confusing, should we write unit test or not.</p>

<p>I have following factory:</p>

<pre><code>(function(myApp) {
myApp.factory('MyFirstFactory', function(MySecondFactory){
  function MyFirstFactory(config){
    this.value1 = 'value1';
    setDefault(this);
  }

   MyFirstFactory.doSomething = function(){
     var config = {
       findWork: true;
       myWork: MySecondFactory.doWork()
     };
     return new MyFirstFactory(config);
   };

  return MyFirstFactory;
});
})(angular.module('MyModule'));
</code></pre>

<p>So for above factory, do we need to write unit test for MyFirstFacotry and doSomething function?
If yes, how can we achieve using jasmine and karma.. Tried following:</p>

<pre><code>describe('MyFirstFactory', function() {
   var mockMyFirstFactory;
   beforeEach(function(){
     module('MyModule');
     inject(function(MyFirstFactory){
        mockMyFirstFactory = MyFirstFactory;
     });
   });

  it('MyFirstFactory should be defined', function(){
     expect(mockMyFirstFactory).toBeDefined();
  });
  it('should do something', function(){
    // how to test doSomething 
  });
});
</code></pre>

<p>I am using jasmine, angular-mock, karma.</p>