Refactor tests for ManageRepository and ShowImages components to improve structure and add necessary imports
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
parent
335f4683fc
commit
9f9d73644b
|
@ -1,5 +1,5 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { CreateRepositoryComponent } from './manage-repository.component';
|
import { ManageRepositoryComponent } from './manage-repository.component';
|
||||||
import { provideHttpClient } from '@angular/common/http';
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
import { ReactiveFormsModule, FormBuilder } from '@angular/forms';
|
import { ReactiveFormsModule, FormBuilder } from '@angular/forms';
|
||||||
|
@ -14,9 +14,9 @@ import { ToastrModule, ToastrService } from 'ngx-toastr';
|
||||||
import { DataService } from '../../calendar/data.service';
|
import { DataService } from '../../calendar/data.service';
|
||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
|
|
||||||
describe('CreateRepositoryComponent', () => {
|
describe('ManageRepositoryComponent', () => {
|
||||||
let component: CreateRepositoryComponent;
|
let component: ManageRepositoryComponent;
|
||||||
let fixture: ComponentFixture<CreateRepositoryComponent>;
|
let fixture: ComponentFixture<ManageRepositoryComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const mockConfigService = {
|
const mockConfigService = {
|
||||||
|
@ -54,7 +54,7 @@ describe('CreateRepositoryComponent', () => {
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(CreateRepositoryComponent);
|
fixture = TestBed.createComponent(ManageRepositoryComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,54 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
import { ShowImagesComponent } from './show-images.component';
|
import { ShowImagesComponent } from './show-images.component';
|
||||||
|
import { ToastrModule } from 'ngx-toastr';
|
||||||
|
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { JoyrideModule } from 'ngx-joyride';
|
||||||
|
import { ConfigService } from '@services/config.service';
|
||||||
|
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
|
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||||
|
import { MatTableModule } from '@angular/material/table';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
|
|
||||||
describe('ShowImagesComponent', () => {
|
describe('ShowImagesComponent', () => {
|
||||||
let component: ShowImagesComponent;
|
let component: ShowImagesComponent;
|
||||||
let fixture: ComponentFixture<ShowImagesComponent>;
|
let fixture: ComponentFixture<ShowImagesComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
const mockConfigService = {
|
||||||
|
apiUrl: 'http://mock-api-url'
|
||||||
|
};
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ShowImagesComponent]
|
declarations: [ShowImagesComponent, LoadingComponent],
|
||||||
|
imports: [
|
||||||
|
HttpClientTestingModule,
|
||||||
|
ToastrModule.forRoot(),
|
||||||
|
MatDialogModule,
|
||||||
|
TranslateModule.forRoot(),
|
||||||
|
JoyrideModule.forRoot(),
|
||||||
|
MatIconModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatPaginatorModule,
|
||||||
|
MatTableModule,
|
||||||
|
FormsModule,
|
||||||
|
NoopAnimationsModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatProgressSpinnerModule
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
{ provide: MatDialogRef, useValue: {} },
|
||||||
|
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||||
|
{ provide: ConfigService, useValue: mockConfigService }
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue