如何使用jasmine

时间:2016-10-06 07:58:56

标签: angular jasmine

****获取LoginInfoService无提供程序的问题*** //以下是ng2控制器组件的源代码。 LoginInfoService具有依赖注入服务,该服务位于ng1。

/// <reference path="../typings1/browser/definitions/jasmine/jasmine.d.ts" />
'use strict';
import {TestBed, async, inject} from "@angular/core/testing";
//import {it, describe, expect, beforeEach, inject} from 'angular2/testing';
import {UnificationCtrl} from './unificationCtrl';
import {LoginInfoService} from './LoginInfoService';
describe('UnificationCtrl.', () => {
   beforeEach(() => {
          TestBed.configureTestingModule(
            {
                //  declarations: [UnificationCtrl],  
                providers: [
                    UnificationCtrl,
                    OverviewUnificationService,
                    StarUnification,
                    SessionKeeper,
                    LoginInfoService,
                    OverviewCommonConstants
                ]
            });
    });

beforeEach(inject([OverviewUnificationService, StarUnification, OverviewCommonConstants], (OverviewUnificationService, StarUnification, OverviewCommonConstants) => {
    }));
    it('test isPendingStatus()', inject([UnificationCtrl, StarUnification], (UnificationCtrl, StarUnification) => {
        console.log('hi');
        expect(StarUnification.stat`enter code here`us.Pending).toEqual('PENDING');
        //    WirelessUsageModel.setBonus(true);
        //    expect(WirelessUsageModel.hasBonus()).toBeTruthy();
    }));

});

0 个答案:

没有答案