Fixed test
parent
b4ba0b1244
commit
b6c00e12d8
|
@ -1,14 +1,62 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SoftwareProfilePartitionComponent } from './software-profile-partition.component';
|
||||
import {FormBuilder, ReactiveFormsModule} from "@angular/forms";
|
||||
import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from "@angular/material/dialog";
|
||||
import {MatFormFieldModule} from "@angular/material/form-field";
|
||||
import {MatInputModule} from "@angular/material/input";
|
||||
import {MatCheckboxModule} from "@angular/material/checkbox";
|
||||
import {MatButtonModule} from "@angular/material/button";
|
||||
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
|
||||
import {ToastrModule, ToastrService} from "ngx-toastr";
|
||||
import {TranslateModule} from "@ngx-translate/core";
|
||||
import {DataService} from "../../data.service";
|
||||
import {provideHttpClient} from "@angular/common/http";
|
||||
import {provideHttpClientTesting} from "@angular/common/http/testing";
|
||||
import {ConfigService} from "@services/config.service";
|
||||
import {MatDividerModule} from "@angular/material/divider";
|
||||
import {MatTableModule} from "@angular/material/table";
|
||||
|
||||
describe('SoftwareProfilePartitionComponent', () => {
|
||||
let component: SoftwareProfilePartitionComponent;
|
||||
let fixture: ComponentFixture<SoftwareProfilePartitionComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const mockConfigService = {
|
||||
apiUrl: 'http://mock-api-url',
|
||||
mercureUrl: 'http://mock-mercure-url'
|
||||
};
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [SoftwareProfilePartitionComponent]
|
||||
declarations: [SoftwareProfilePartitionComponent],
|
||||
imports: [
|
||||
ReactiveFormsModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatCheckboxModule,
|
||||
MatButtonModule,
|
||||
BrowserAnimationsModule,
|
||||
MatDividerModule,
|
||||
MatTableModule,
|
||||
ToastrModule.forRoot(),
|
||||
TranslateModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
FormBuilder,
|
||||
ToastrService,
|
||||
DataService,
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
{
|
||||
provide: MatDialogRef,
|
||||
useValue: {}
|
||||
},
|
||||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: {}
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService }
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ export class SoftwareProfilePartitionComponent implements OnInit{
|
|||
private toastService: ToastrService,
|
||||
) {
|
||||
this.baseUrl = this.configService.apiUrl;
|
||||
this.clientId = this.data.client.clientId
|
||||
this.clientId = this.data.client?.clientId
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -72,7 +72,7 @@ export class SoftwareProfilePartitionComponent implements OnInit{
|
|||
}
|
||||
|
||||
loadPartitions() {
|
||||
const url = `${this.baseUrl}/clients/${this.data.client.clientId}`;
|
||||
const url = `${this.baseUrl}/clients/${this.data.client?.clientId}`;
|
||||
this.http.get(url).subscribe(
|
||||
(response: any) => {
|
||||
if (response.partitions) {
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { PXEimagesComponent } from './pxe-images.component';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { of } from 'rxjs';
|
||||
import { of } from 'rxjs';
|
||||
import { MatAccordion, MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle, MatExpansionPanelDescription } from '@angular/material/expansion';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatDivider } from '@angular/material/divider';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
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';
|
||||
import {MatProgressSpinner, MatProgressSpinnerModule, MatSpinner} from "@angular/material/progress-spinner";
|
||||
|
||||
describe('PXEimagesComponent', () => {
|
||||
let component: PXEimagesComponent;
|
||||
|
@ -42,13 +43,14 @@ describe('PXEimagesComponent', () => {
|
|||
MatExpansionPanelDescription,
|
||||
MatIcon,
|
||||
MatDivider,
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
MatPaginatorModule,
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
MatPaginatorModule,
|
||||
BrowserAnimationsModule,
|
||||
FormsModule,
|
||||
MatInputModule,
|
||||
MatTableModule,
|
||||
MatTableModule,
|
||||
MatProgressSpinnerModule,
|
||||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
],
|
||||
|
|
|
@ -25,6 +25,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||
import { JoyrideModule } from 'ngx-joyride';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
import {MatProgressSpinnerModule} from "@angular/material/progress-spinner";
|
||||
|
||||
describe('PxeComponent', () => {
|
||||
let component: PxeComponent;
|
||||
|
@ -45,7 +46,7 @@ describe('PxeComponent', () => {
|
|||
BrowserAnimationsModule,
|
||||
MatDialogModule,
|
||||
MatTableModule,
|
||||
MatAccordion, MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle,
|
||||
MatAccordion, MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle,
|
||||
MatExpansionPanelDescription,
|
||||
MatIcon,
|
||||
MatDivider,
|
||||
|
@ -55,6 +56,7 @@ describe('PxeComponent', () => {
|
|||
MatSelect,
|
||||
MatOption,
|
||||
MatPaginator,
|
||||
MatProgressSpinnerModule,
|
||||
ToastrModule.forRoot(),
|
||||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
|
@ -63,8 +65,8 @@ describe('PxeComponent', () => {
|
|||
DatePipe,
|
||||
DataService,
|
||||
{ provide: ConfigService, useValue: mockConfigService },
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting()
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting()
|
||||
]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
@ -138,4 +140,4 @@ describe('PxeComponent', () => {
|
|||
it('should have a defined selectedItem', () => {
|
||||
expect(component.selectedItem).toBeDefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"apiUrl": "https://127.0.0.1:8443",
|
||||
"apiUrl": "https://192.168.68.62:8443",
|
||||
"mercureUrl": "http://localhost:3000/.well-known/mercure"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue