skipped_tests_fix

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2019-02-15 14:34:07 +08:00
parent d28b8355ef
commit 4ee5ebe442
2 changed files with 20 additions and 4 deletions

View File

@ -7,13 +7,27 @@ import { SharedModule } from "../../shared/shared.module";
import { ErrorHandler } from '../../error-handler/error-handler'; import { ErrorHandler } from '../../error-handler/error-handler';
import { GcViewModelFactory } from './gc.viewmodel.factory'; import { GcViewModelFactory } from './gc.viewmodel.factory';
import { GcUtility } from './gc.utility'; import { GcUtility } from './gc.utility';
import { of } from 'rxjs';
describe('GcComponent', () => { describe('GcComponent', () => {
let component: GcComponent; let component: GcComponent;
let fixture: ComponentFixture<GcComponent>; let fixture: ComponentFixture<GcComponent>;
let gcRepoService: GcRepoService;
let config: IServiceConfig = { let config: IServiceConfig = {
systemInfoEndpoint: "/api/system/gc" 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(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
@ -35,9 +49,12 @@ describe('GcComponent', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(GcComponent); fixture = TestBed.createComponent(GcComponent);
component = fixture.componentInstance; 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(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });

View File

@ -175,8 +175,7 @@ describe("TagComponent (inline template)", () => {
expect(spy.calls.any).toBeTruthy(); expect(spy.calls.any).toBeTruthy();
})); }));
// fail after upgrade to angular 6. it("should load and render data", () => {
xit("should load and render data", async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
fixture.detectChanges(); fixture.detectChanges();
@ -187,7 +186,7 @@ describe("TagComponent (inline template)", () => {
expect(el).toBeTruthy(); expect(el).toBeTruthy();
expect(el.textContent.trim()).toEqual("1.11.5"); expect(el.textContent.trim()).toEqual("1.11.5");
}); });
})); });
}); });