Enhance unit tests for ClientTaskLogs and OutputDialog components by adding necessary imports, providers, and schemas
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
parent
757de78dc4
commit
d10a209a25
|
@ -1,16 +1,48 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { ClientTaskLogsComponent } from './client-task-logs.component';
|
||||
import { JoyrideService } from 'ngx-joyride';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { LoadingComponent } from 'src/app/shared/loading/loading.component';
|
||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('ClientTaskLogsComponent', () => {
|
||||
let component: ClientTaskLogsComponent;
|
||||
let fixture: ComponentFixture<ClientTaskLogsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockJoyrideService = jasmine.createSpyObj('JoyrideService', ['startTour']);
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ClientTaskLogsComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ClientTaskLogsComponent, LoadingComponent],
|
||||
imports: [HttpClientTestingModule,
|
||||
ToastrModule.forRoot(),
|
||||
MatIconModule,
|
||||
TranslateModule.forRoot(),
|
||||
MatFormFieldModule,
|
||||
MatPaginatorModule,
|
||||
MatSelectModule,
|
||||
BrowserAnimationsModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: { close: jasmine.createSpy('close') } },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: JoyrideService, useValue: mockJoyrideService },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ClientTaskLogsComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@ -20,4 +52,4 @@ describe('ClientTaskLogsComponent', () => {
|
|||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,6 +1,7 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { OutputDialogComponent } from './output-dialog.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
describe('OutputDialogComponent', () => {
|
||||
let component: OutputDialogComponent;
|
||||
|
@ -8,9 +9,16 @@ describe('OutputDialogComponent', () => {
|
|||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [OutputDialogComponent]
|
||||
declarations: [OutputDialogComponent],
|
||||
imports: [
|
||||
TranslateModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: { close: jasmine.createSpy('close') } },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: { input: {} } }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(OutputDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@ -20,4 +28,4 @@ describe('OutputDialogComponent', () => {
|
|||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue