title: Testing Angular Modules with Jasmine Unit Tests
body: <p>I am using an AngularJS service in my app. I've learned that the service I've created is unreliable. For that reason, I want to build some unit tests around it. While the service works fine in my AngularJS app, I'm having problems getting it to work with Jasmine. Its like I can't load any modules. I've strip down the code to the bare bones. I do not understand what I'm doing wrong. My code looks like this:</p>
  
  <p><strong>myService.js</strong></p>
  
  <pre><code>'use strict';
  angular.module('customModule', [])
      .factory('$serviceName', [function () {    
          return {    
              isAvailable: function () {
                  return true;
              }
          };
      }]
  );
  </code></pre>
  
  <p><strong>myService.spec.js</strong></p>
  
  <pre><code>  describe('customModule', function() {
      beforeEach(function() {
          console.log('loading module...');
          module('customModule');
      });
  
      describe('$serviceName', function () {
          var myService = null;
          beforeEach(inject(function ($serviceName) {
              console.log('loading service...');
              myService = $serviceName;
          }));
  
          it('should work', function () {
              console.log('testing');
              var isAvailable = myService.isAvailable();
              console.log(isAvailable);
              expect(1 + 2).toEqual(3);
          });
      });
    })
  </code></pre>
  
  <p><strong>gruntfile.js</strong></p>
  
  <pre><code>'use strict';
  module.exports = function (grunt) {
    grunt.initConfig({
      jasmine: {
        unitTests: {
          src: 'test/*.js',
        }
      }
    });
  
    require('load-grunt-tasks')(grunt);
    grunt.registerTask('default', ['jasmine:unitTests']);
  };
  </code></pre>
  
  <p>My jasmine tests are running. However, its like myService.js isn't being loaded. I'm not sure how to do that. I'm also not sure how to get 'angular' (used in myService.js) in the tests either.</p>
  
  <p>Thank you for your help.</p>