diff --git a/src/portal/lib/src/config/gc/gc.component.spec.ts b/src/portal/lib/src/config/gc/gc.component.spec.ts index 0c655d0a7..6ea81f5e9 100644 --- a/src/portal/lib/src/config/gc/gc.component.spec.ts +++ b/src/portal/lib/src/config/gc/gc.component.spec.ts @@ -7,13 +7,27 @@ import { SharedModule } from "../../shared/shared.module"; import { ErrorHandler } from '../../error-handler/error-handler'; import { GcViewModelFactory } from './gc.viewmodel.factory'; import { GcUtility } from './gc.utility'; +import { of } from 'rxjs'; describe('GcComponent', () => { let component: GcComponent; let fixture: ComponentFixture; + let gcRepoService: GcRepoService; let config: IServiceConfig = { systemInfoEndpoint: "/api/system/gc" }; + let mockSchedule = []; + let mockJobs = [ + { + id: 22222, + schedule: null, + job_status: 'string', + creation_time: new Date(), + update_time: new Date(), + } + ]; + let spySchedule: jasmine.Spy; + let spyJobs: jasmine.Spy; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ @@ -35,9 +49,12 @@ describe('GcComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(GcComponent); component = fixture.componentInstance; + + gcRepoService = fixture.debugElement.injector.get(GcRepoService); + spySchedule = spyOn(gcRepoService, "getSchedule").and.returnValues(of(mockSchedule)); + spyJobs = spyOn(gcRepoService, "getJobs").and.returnValues(of(mockJobs)); fixture.detectChanges(); }); - it('should create', () => { expect(component).toBeTruthy(); }); diff --git a/src/portal/lib/src/tag/tag.component.spec.ts b/src/portal/lib/src/tag/tag.component.spec.ts index 9d0da10a3..56b12dee3 100644 --- a/src/portal/lib/src/tag/tag.component.spec.ts +++ b/src/portal/lib/src/tag/tag.component.spec.ts @@ -175,8 +175,7 @@ describe("TagComponent (inline template)", () => { expect(spy.calls.any).toBeTruthy(); })); - // fail after upgrade to angular 6. - xit("should load and render data", async(() => { + it("should load and render data", () => { fixture.detectChanges(); fixture.whenStable().then(() => { fixture.detectChanges(); @@ -187,7 +186,7 @@ describe("TagComponent (inline template)", () => { expect(el).toBeTruthy(); expect(el.textContent.trim()).toEqual("1.11.5"); }); - })); + }); });