如何使用AngularJS中的MochaJS对正确的方法进行单元测试

时间:2017-06-21 00:36:44

标签: angularjs unit-testing mocha karma-mocha

我是使用MochaJS进行单元测试的新手。所以,我需要一些我测试我的应用程序的单元测试代码的帮助。但是,出于某种原因,我得到TypeError: module is not a function。另外,有没有人知道关于单元测试或端到端测试的任何好的教程?谢谢你的帮助。

  

这是我的单元测试

    describe('Testing AngularJS Test Suite', function(){
describe('Testing AngularJS Controller', function(){

    it('should initialize the update user in the scope', function(){

    module('Portal');

    var scope = {};
    var ctrl;

    inject(function($controller){

        ctrl = $controller('HomeController', {$scope:scope});


    });

    expect(scope.title).toBeDefine();  
    expect(scope.title).toBe('Portal');  




    });




});
}); 

0 个答案:

没有答案
相关问题