diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.spec.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.spec.ts index 98afae3..221a31a 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.spec.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.spec.ts @@ -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; 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(); diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.ts index 5110f2a..100593f 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.ts @@ -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) { diff --git a/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.spec.ts b/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.spec.ts index d9a820e..126e0a3 100644 --- a/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.spec.ts +++ b/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.spec.ts @@ -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(), ], diff --git a/ogWebconsole/src/app/components/ogboot/pxe/pxe.component.spec.ts b/ogWebconsole/src/app/components/ogboot/pxe/pxe.component.spec.ts index e7762e7..4991989 100644 --- a/ogWebconsole/src/app/components/ogboot/pxe/pxe.component.spec.ts +++ b/ogWebconsole/src/app/components/ogboot/pxe/pxe.component.spec.ts @@ -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(); }); -}); \ No newline at end of file +}); diff --git a/ogWebconsole/src/assets/config.json b/ogWebconsole/src/assets/config.json index 2a53caa..72ade48 100644 --- a/ogWebconsole/src/assets/config.json +++ b/ogWebconsole/src/assets/config.json @@ -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" }