Merge pull request #6944 from jwangyangls/skipped_tests_fix

Skipped tests fix
This commit is contained in:
jwangyangls 2019-02-15 17:48:03 +08:00 committed by GitHub
commit 9b9fa4fc83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 { GcViewModelFactory } from './gc.viewmodel.factory';
import { GcUtility } from './gc.utility';
import { of } from 'rxjs';
describe('GcComponent', () => {
let component: GcComponent;
let fixture: ComponentFixture<GcComponent>;
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();
});

View File

@ -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");
});
}));
});
});