2015-02-24 24 views
0

我正在爲我的一個工廠創建單元測試,這是我第一次使用Angularj創建測試。當我在我的目錄的根目錄下運行grunt測試時,我得到一個錯誤找不到插件karma-phantomjs-launcher。如何使用Angularjs創建單元測試?

代碼試過到目前爲止...

Factory.spec.js

describe('lrrDetails', function() { 
     'use strict'; 

     var httpBackend, serviceToTest, lrrSearchModalFactory; 
     beforeEach(module('thirdPartyManagementApp')); 

     beforeEach(inject(function ($httpBackend, lrrDetails) { 
      httpBackend = $httpBackend; 
      lrrSearchModalFactory = lrrDetails; 

     })); 

     it('should call the API to get Lrr Details for Dialog box', function (regInventoryId) { 
      httpBackend.expectGET('/third-party-management/rest/lrr/' + regInventoryId).respond(200, 'success'); 
      var promise = lrrSearchModalFactory.findlrrDetail(); 
      httpBackend.flush(); 
      promise.then(function (data) { 
       expect(data.data).toBe('success'); 
      }); 
     }); 


    }); 

回答