Angular unit-testing $ logProvider配置

时间:2016-03-14 16:22:25

标签: angularjs

我做错了什么?我想测试$ logProvider,但似乎应用程序没有配置注入...

"use strict";

var $log$;

describe("logProvider", () => {

    var prov;

    beforeEach(angular.mock.module('app',($logProvider)=>{
        spyOn($logProvider,'debugEnabled');
        prov = $logProvider;
    }));

    beforeEach(inject((_$log_) => { }));

    it("should be defined", () => {
        expect(prov.debugEnabled).toHaveBeenCalledWith();
    });

});

我的日志提供程序配置。

export function logProvider($logProvider){
    'ngInject';

    $logProvider.debugEnabled(true);

}

错误:

  PhantomJS 1.9.8 (Linux 0.0.0)
Expected spy debugEnabled to have been called with [  ] but it was never called.

0 个答案:

没有答案