refs #1700 Add mock ConfigService to component tests for improved isolation
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
parent
44199881cc
commit
e230b3b41d
|
@ -7,6 +7,7 @@ import { ToastrService } from 'ngx-toastr';
|
|||
import { of } from 'rxjs';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
class MockToastrService {
|
||||
success() {}
|
||||
|
@ -18,6 +19,11 @@ describe('UsersComponent', () => {
|
|||
let fixture: ComponentFixture<UsersComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [UsersComponent],
|
||||
imports: [
|
||||
|
@ -28,6 +34,7 @@ describe('UsersComponent', () => {
|
|||
],
|
||||
providers: [
|
||||
{ provide: ToastrService, useClass: MockToastrService },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA], // Ignorar elementos desconocidos
|
||||
}).compileComponents();
|
||||
|
|
|
@ -16,12 +16,18 @@ import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
|||
import { JoyrideModule, JoyrideService } from 'ngx-joyride';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { LoadingComponent } from '../../shared/loading/loading.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('CalendarComponent', () => {
|
||||
let component: CalendarComponent;
|
||||
let fixture: ComponentFixture<CalendarComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CalendarComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -41,6 +47,9 @@ describe('CalendarComponent', () => {
|
|||
JoyrideModule.forRoot(),
|
||||
TranslateModule.forRoot(),
|
||||
],
|
||||
providers: [
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
|
|
@ -13,11 +13,16 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { JoyrideModule, JoyrideService, JoyrideStepService } from 'ngx-joyride';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('CommandsTaskComponent', () => {
|
||||
let component: CommandsTaskComponent;
|
||||
let fixture: ComponentFixture<CommandsTaskComponent>;
|
||||
let mockConfigService: jasmine.SpyObj<ConfigService>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const configServiceSpy = jasmine.createSpyObj('ConfigService', [], { apiUrl: 'http://mock-api-url' });
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
|
@ -33,8 +38,13 @@ describe('CommandsTaskComponent', () => {
|
|||
JoyrideModule.forRoot(),
|
||||
],
|
||||
declarations: [CommandsTaskComponent, LoadingComponent],
|
||||
providers: [
|
||||
{ provide: ConfigService, useValue: configServiceSpy }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents();
|
||||
|
||||
mockConfigService = TestBed.inject(ConfigService) as jasmine.SpyObj<ConfigService>;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -20,12 +20,18 @@ import { NgxChartsModule } from '@swimlane/ngx-charts';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('CommandsComponent', () => {
|
||||
let component: CommandsComponent;
|
||||
let fixture: ComponentFixture<CommandsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CommandsComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -53,7 +59,8 @@ describe('CommandsComponent', () => {
|
|||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
|
||||
}).compileComponents();
|
||||
|
|
|
@ -13,12 +13,18 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
|
|||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('CreateCommandComponent', () => {
|
||||
let component: CreateCommandComponent;
|
||||
let fixture: ComponentFixture<CreateCommandComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CreateCommandComponent],
|
||||
imports: [
|
||||
|
@ -45,7 +51,8 @@ describe('CreateCommandComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExecuteCommandComponent } from './execute-command.component';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
@ -17,12 +16,18 @@ import { ToastrModule, ToastrService } from 'ngx-toastr';
|
|||
import { DataService } from '../data.service';
|
||||
import {MatIconModule} from "@angular/material/icon";
|
||||
import {MatMenu, MatMenuModule} from "@angular/material/menu";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('ExecuteCommandComponent', () => {
|
||||
let component: ExecuteCommandComponent;
|
||||
let fixture: ComponentFixture<ExecuteCommandComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ExecuteCommandComponent],
|
||||
imports: [
|
||||
|
@ -54,7 +59,8 @@ describe('ExecuteCommandComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DeployImageComponent } from './deploy-image.component';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
@ -11,7 +10,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatRadioModule } from '@angular/material/radio'; // Importar MatRadioModule
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ToastrModule, ToastrService } from 'ngx-toastr';
|
||||
|
@ -19,12 +18,18 @@ import { provideRouter } from '@angular/router';
|
|||
import { MatSelectModule } from '@angular/material/select';
|
||||
import {MatExpansionModule} from "@angular/material/expansion";
|
||||
import {LoadingComponent} from "../../../../../shared/loading/loading.component";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('DeployImageComponent', () => {
|
||||
let component: DeployImageComponent;
|
||||
let fixture: ComponentFixture<DeployImageComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [DeployImageComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -57,7 +62,8 @@ describe('DeployImageComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -27,12 +27,18 @@ import { MatTreeModule } from '@angular/material/tree';
|
|||
import { TreeNode } from './model/model';
|
||||
import { LoadingComponent } from '../../shared/loading/loading.component';
|
||||
import { ExecuteCommandComponent } from '../commands/main-commands/execute-command/execute-command.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('GroupsComponent', () => {
|
||||
let component: GroupsComponent;
|
||||
let fixture: ComponentFixture<GroupsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [GroupsComponent, ExecuteCommandComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -63,7 +69,8 @@ describe('GroupsComponent', () => {
|
|||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: { data: { id: 123 } } }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: { data: { id: 123 } } },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
|
@ -128,4 +135,4 @@ describe('GroupsComponent', () => {
|
|||
{ params: jasmine.any(Object) }
|
||||
);
|
||||
});
|
||||
});
|
||||
})
|
|
@ -8,12 +8,18 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { ManageClientComponent } from './manage-client.component';
|
||||
import { DataService } from '../../../services/data.service';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('ManageClientComponent', () => {
|
||||
let component: ManageClientComponent;
|
||||
let fixture: ComponentFixture<ManageClientComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ManageClientComponent],
|
||||
imports: [
|
||||
|
@ -28,6 +34,7 @@ describe('ManageClientComponent', () => {
|
|||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: { uuid: '123', organizationalUnit: { '@id': '/units/1' } } },
|
||||
{ provide: ConfigService, useValue: mockConfigService },
|
||||
DataService
|
||||
]
|
||||
})
|
||||
|
|
|
@ -13,12 +13,18 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { LoadingComponent } from '../../../../../shared/loading/loading.component';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('ManageOrganizationalUnitComponent', () => {
|
||||
let component: ManageOrganizationalUnitComponent;
|
||||
let fixture: ComponentFixture<ManageOrganizationalUnitComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ManageOrganizationalUnitComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -36,7 +42,8 @@ describe('ManageOrganizationalUnitComponent', () => {
|
|||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExportImageComponent } from './export-image.component';
|
||||
import {FormBuilder, ReactiveFormsModule} from "@angular/forms";
|
||||
import {ToastrModule, ToastrService} from "ngx-toastr";
|
||||
|
@ -14,12 +13,18 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
|
|||
import {TranslateModule} from "@ngx-translate/core";
|
||||
import {LoadingComponent} from "../../../shared/loading/loading.component";
|
||||
import {MatProgressSpinner} from "@angular/material/progress-spinner";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('ExportImageComponent', () => {
|
||||
let component: ExportImageComponent;
|
||||
let fixture: ComponentFixture<ExportImageComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ExportImageComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -46,7 +51,9 @@ describe('ExportImageComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}]
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
|
|
@ -9,12 +9,18 @@ import { MatInputModule } from '@angular/material/input';
|
|||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('LoginComponent', () => {
|
||||
let component: LoginComponent;
|
||||
let fixture: ComponentFixture<LoginComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [LoginComponent],
|
||||
imports: [
|
||||
|
@ -26,7 +32,10 @@ describe('LoginComponent', () => {
|
|||
MatIconModule,
|
||||
TranslateModule.forRoot()
|
||||
],
|
||||
providers: [provideHttpClient(withInterceptorsFromDi())]
|
||||
providers: [
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(LoginComponent);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MenusComponent } from './menus.component';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
|
@ -23,15 +22,21 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('MenusComponent', () => {
|
||||
let component: MenusComponent;
|
||||
let fixture: ComponentFixture<MenusComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [MenusComponent],
|
||||
imports: [ HttpClientTestingModule, ToastrModule.forRoot(), BrowserAnimationsModule, MatDividerModule, MatFormFieldModule, MatInputModule, MatIconModule, MatButtonModule, MatTableModule, MatPaginatorModule, MatTooltipModule, FormsModule, ReactiveFormsModule, MatProgressSpinnerModule, MatDialogModule, MatSelectModule, MatTabsModule, MatAutocompleteModule, MatListModule, MatCardModule, MatMenuModule, TranslateModule.forRoot(), JoyrideModule.forRoot(), ],
|
||||
providers: [ { provide: ConfigService, useValue: mockConfigService } ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
|
|
@ -19,11 +19,17 @@ import { ToastrModule } from 'ngx-toastr';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import {LoadingComponent} from "../../../shared/loading/loading.component";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('OgbootStatusComponent', () => {
|
||||
let component: OgbootStatusComponent;
|
||||
let fixture: ComponentFixture<OgbootStatusComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [OgbootStatusComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -50,7 +56,8 @@ describe('OgbootStatusComponent', () => {
|
|||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
|
|
@ -14,12 +14,18 @@ import { MatInputModule } from '@angular/material/input';
|
|||
import { MatTableModule } from '@angular/material/table';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('PxeBootFilesComponent', () => {
|
||||
let component: PxeBootFilesComponent;
|
||||
let fixture: ComponentFixture<PxeBootFilesComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [PxeBootFilesComponent],
|
||||
imports: [
|
||||
|
@ -43,7 +49,7 @@ describe('PxeBootFilesComponent', () => {
|
|||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
],
|
||||
providers: [NgControl]
|
||||
providers: [NgControl, { provide: ConfigService, useValue: mockConfigService }]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import { MatTableModule } from '@angular/material/table';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('PXEimagesComponent', () => {
|
||||
let component: PXEimagesComponent;
|
||||
|
@ -25,6 +26,11 @@ describe('PXEimagesComponent', () => {
|
|||
|
||||
beforeEach(async () => {
|
||||
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
mockToastrService = jasmine.createSpyObj('ToastrService', ['success', 'error']);
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [PXEimagesComponent, LoadingComponent],
|
||||
|
@ -47,7 +53,8 @@ describe('PXEimagesComponent', () => {
|
|||
JoyrideModule.forRoot(),
|
||||
],
|
||||
providers: [
|
||||
{ provide: ToastrService, useValue: mockToastrService }
|
||||
{ provide: ToastrService, useValue: mockToastrService },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
|
||||
})
|
||||
|
|
|
@ -17,18 +17,25 @@ import { MatHint } from '@angular/material/form-field';
|
|||
import { MatSelect } from '@angular/material/select';
|
||||
import { MatOption } from '@angular/material/select';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('PxeComponent', () => {
|
||||
let component: PxeComponent;
|
||||
let fixture: ComponentFixture<PxeComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [PxeComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -55,6 +62,7 @@ describe('PxeComponent', () => {
|
|||
providers: [
|
||||
DatePipe,
|
||||
DataService,
|
||||
{ provide: ConfigService, useValue: mockConfigService },
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting()
|
||||
]
|
||||
|
@ -130,4 +138,4 @@ describe('PxeComponent', () => {
|
|||
it('should have a defined selectedItem', () => {
|
||||
expect(component.selectedItem).toBeDefined();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -17,6 +17,7 @@ import { MatTableModule } from '@angular/material/table';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { LoadingComponent } from '../../shared/loading/loading.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('OgDhcpSubnetsComponent', () => {
|
||||
let component: OgDhcpSubnetsComponent;
|
||||
|
@ -26,6 +27,10 @@ describe('OgDhcpSubnetsComponent', () => {
|
|||
let mockToastrService: jasmine.SpyObj<ToastrService>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
mockDialog = jasmine.createSpyObj('MatDialog', ['open']);
|
||||
mockHttpClient = jasmine.createSpyObj('HttpClient', ['get', 'post', 'put', 'delete']);
|
||||
mockToastrService = jasmine.createSpyObj('ToastrService', ['success', 'error']);
|
||||
|
@ -52,6 +57,7 @@ describe('OgDhcpSubnetsComponent', () => {
|
|||
{ provide: MatDialog, useValue: mockDialog },
|
||||
{ provide: HttpClient, useValue: mockHttpClient },
|
||||
{ provide: ToastrService, useValue: mockToastrService },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
|
|
@ -18,7 +18,8 @@ import { HttpClient } from '@angular/common/http';
|
|||
import { ToastrService } from "ngx-toastr";
|
||||
import { of } from "rxjs";
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; // Add this import
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('ShowClientsComponent', () => {
|
||||
let component: ShowClientsComponent;
|
||||
|
@ -28,6 +29,10 @@ describe('ShowClientsComponent', () => {
|
|||
let mockToastrService: jasmine.SpyObj<ToastrService>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
mockDialog = jasmine.createSpyObj('MatDialog', ['open']);
|
||||
mockToastrService = jasmine.createSpyObj('ToastrService', ['success', 'error']);
|
||||
|
||||
|
@ -48,13 +53,14 @@ describe('ShowClientsComponent', () => {
|
|||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
HttpClientTestingModule,
|
||||
MatProgressSpinnerModule // Add this import
|
||||
MatProgressSpinnerModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialog, useValue: mockDialog },
|
||||
{ provide: ToastrService, useValue: mockToastrService },
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
],
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { StatusComponent } from './status.component';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
|
@ -21,12 +20,18 @@ import { NgxChartsModule } from '@swimlane/ngx-charts';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import {LoadingComponent} from "../../../shared/loading/loading.component";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('StatusComponent', () => {
|
||||
let component: StatusComponent;
|
||||
let fixture: ComponentFixture<StatusComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [StatusComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -53,7 +58,8 @@ describe('StatusComponent', () => {
|
|||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CreateOperativeSystemComponent } from './create-operative-system.component';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
|
@ -15,12 +14,17 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('CreateOperativeSystemComponent', () => {
|
||||
let component: CreateOperativeSystemComponent;
|
||||
let fixture: ComponentFixture<CreateOperativeSystemComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CreateOperativeSystemComponent],
|
||||
imports: [
|
||||
|
@ -42,8 +46,9 @@ describe('CreateOperativeSystemComponent', () => {
|
|||
ReactiveFormsModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} }, // Proporciona un mock de MatDialogRef
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} } // Proporciona un mock de MAT_DIALOG_DATA si es necesario
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { OperativeSystemComponent } from './operative-system.component';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
@ -16,12 +15,18 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('OperativeSystemComponent', () => {
|
||||
let component: OperativeSystemComponent;
|
||||
let fixture: ComponentFixture<OperativeSystemComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [OperativeSystemComponent],
|
||||
imports: [
|
||||
|
@ -40,6 +45,9 @@ describe('OperativeSystemComponent', () => {
|
|||
MatProgressSpinner,
|
||||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
],
|
||||
providers: [
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BackupImageComponent } from './backup-image.component';
|
||||
import {ImportImageComponent} from "../import-image/import-image.component";
|
||||
import {FormBuilder, ReactiveFormsModule} from "@angular/forms";
|
||||
|
@ -14,12 +13,18 @@ import {TranslateModule} from "@ngx-translate/core";
|
|||
import {provideHttpClient} from "@angular/common/http";
|
||||
import {provideHttpClientTesting} from "@angular/common/http/testing";
|
||||
import {LoadingComponent} from "../../../shared/loading/loading.component";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('BackupImageComponent', () => {
|
||||
let component: BackupImageComponent;
|
||||
let fixture: ComponentFixture<BackupImageComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [BackupImageComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -45,7 +50,9 @@ describe('BackupImageComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}]
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
|
|
@ -7,12 +7,18 @@ import { MatInputModule } from '@angular/material/input';
|
|||
import { FormsModule } from '@angular/forms';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ConvertImageComponent } from './convert-image.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('ConvertImageComponent', () => {
|
||||
let component: ConvertImageComponent;
|
||||
let fixture: ComponentFixture<ConvertImageComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ConvertImageComponent],
|
||||
imports: [
|
||||
|
@ -26,7 +32,8 @@ describe('ConvertImageComponent', () => {
|
|||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CreateRepositoryComponent } from './create-repository.component';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
@ -13,12 +12,18 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ToastrModule, ToastrService } from 'ngx-toastr';
|
||||
import { DataService } from '../../calendar/data.service';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('CreateRepositoryComponent', () => {
|
||||
let component: CreateRepositoryComponent;
|
||||
let fixture: ComponentFixture<CreateRepositoryComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ReactiveFormsModule,
|
||||
|
@ -44,7 +49,8 @@ describe('CreateRepositoryComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ImportImageComponent } from './import-image.component';
|
||||
import { FormBuilder, FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||
import { ToastrModule, ToastrService } from "ngx-toastr";
|
||||
|
@ -12,12 +11,18 @@ import { TranslateModule } from "@ngx-translate/core";
|
|||
import { MatButtonModule } from "@angular/material/button";
|
||||
import { MatInputModule } from "@angular/material/input";
|
||||
import { MatSelectModule } from "@angular/material/select";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('ImportImageComponent', () => {
|
||||
let component: ImportImageComponent;
|
||||
let fixture: ComponentFixture<ImportImageComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ImportImageComponent],
|
||||
imports: [
|
||||
|
@ -41,6 +46,7 @@ describe('ImportImageComponent', () => {
|
|||
provide: MatDialogRef,
|
||||
useValue: {}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService },
|
||||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MainRepositoryViewComponent } from './main-repository-view.component';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
@ -17,12 +16,18 @@ import { CommonModule } from '@angular/common';
|
|||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('MainRepositoryViewComponent', () => {
|
||||
let component: MainRepositoryViewComponent;
|
||||
let fixture: ComponentFixture<MainRepositoryViewComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [MainRepositoryViewComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -52,7 +57,8 @@ describe('MainRepositoryViewComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents();
|
||||
|
@ -65,4 +71,4 @@ describe('MainRepositoryViewComponent', () => {
|
|||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RepositoriesComponent } from './repositories.component';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
|
@ -19,14 +18,20 @@ import { ToastrModule, ToastrService } from 'ngx-toastr';
|
|||
import { DataService } from '../calendar/data.service';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {LoadingComponent} from "../../shared/loading/loading.component";
|
||||
import {MatProgressSpinner} from "@angular/material/progress-spinner";
|
||||
import { LoadingComponent } from "../../shared/loading/loading.component";
|
||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('RepositoriesComponent', () => {
|
||||
let component: RepositoriesComponent;
|
||||
let fixture: ComponentFixture<RepositoriesComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [RepositoriesComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -42,7 +47,7 @@ describe('RepositoriesComponent', () => {
|
|||
MatDividerModule,
|
||||
MatIconModule,
|
||||
BrowserAnimationsModule,
|
||||
MatProgressSpinner,
|
||||
MatProgressSpinnerModule,
|
||||
ToastrModule.forRoot(),
|
||||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
|
@ -61,7 +66,8 @@ describe('RepositoriesComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
|
@ -73,4 +79,4 @@ describe('RepositoriesComponent', () => {
|
|||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { ReactiveFormsModule, FormsModule, FormBuilder } from '@angular/forms';
|
||||
|
@ -22,12 +21,18 @@ import {RepositoryImagesComponent} from "./repository-images.component";
|
|||
import {LoadingComponent} from "../../../shared/loading/loading.component";
|
||||
import {MatOptionModule} from "@angular/material/core";
|
||||
import {MatSelectModule} from "@angular/material/select";
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('RepositoriesComponent', () => {
|
||||
let component: RepositoryImagesComponent;
|
||||
let fixture: ComponentFixture<RepositoryImagesComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [RepositoryImagesComponent, LoadingComponent],
|
||||
imports: [
|
||||
|
@ -63,7 +68,8 @@ describe('RepositoriesComponent', () => {
|
|||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
|
|
|
@ -19,12 +19,17 @@ import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/materia
|
|||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('CreateSoftwareProfileComponent', () => {
|
||||
let component: CreateSoftwareProfileComponent;
|
||||
let fixture: ComponentFixture<CreateSoftwareProfileComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CreateSoftwareProfileComponent],
|
||||
imports: [
|
||||
|
@ -50,7 +55,8 @@ describe('CreateSoftwareProfileComponent', () => {
|
|||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -18,12 +18,16 @@ import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform
|
|||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('SoftwareProfileComponent', () => {
|
||||
let component: SoftwareProfileComponent;
|
||||
let fixture: ComponentFixture<SoftwareProfileComponent>;
|
||||
let mockConfigService: jasmine.SpyObj<ConfigService>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const configServiceSpy = jasmine.createSpyObj('ConfigService', [], { apiUrl: 'http://mock-api-url' });
|
||||
|
||||
Object.defineProperty(window, 'getComputedStyle', {
|
||||
value: () => ({
|
||||
getPropertyValue: (prop: string) => '',
|
||||
|
@ -51,10 +55,17 @@ describe('SoftwareProfileComponent', () => {
|
|||
MatSelectModule,
|
||||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
],
|
||||
providers: [
|
||||
{ provide: ConfigService, useValue: configServiceSpy }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
mockConfigService = TestBed.inject(ConfigService) as jasmine.SpyObj<ConfigService>;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SoftwareProfileComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -63,4 +74,4 @@ describe('SoftwareProfileComponent', () => {
|
|||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +1,4 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CreateSoftwareComponent } from './create-software.component';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
|
@ -17,12 +16,18 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('CreateSoftwareComponent', () => {
|
||||
let component: CreateSoftwareComponent;
|
||||
let fixture: ComponentFixture<CreateSoftwareComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CreateSoftwareComponent],
|
||||
imports: [
|
||||
|
@ -45,8 +50,9 @@ describe('CreateSoftwareComponent', () => {
|
|||
MatSelectModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: {} }, // Proporciona un mock de MatDialogRef
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} } // Proporciona un mock de MAT_DIALOG_DATA si es necesario
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -18,12 +18,18 @@ import { ReactiveFormsModule } from '@angular/forms';
|
|||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
describe('SoftwareComponent', () => {
|
||||
let component: SoftwareComponent;
|
||||
let fixture: ComponentFixture<SoftwareComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [SoftwareComponent],
|
||||
imports: [
|
||||
|
@ -45,6 +51,8 @@ describe('SoftwareComponent', () => {
|
|||
MatSelectModule,
|
||||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
], providers: [
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
Loading…
Reference in New Issue