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) {
|
||||
|
|
|
@ -17,6 +17,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 {MatProgressSpinner, MatProgressSpinnerModule, MatSpinner} from "@angular/material/progress-spinner";
|
||||
|
||||
describe('PXEimagesComponent', () => {
|
||||
let component: PXEimagesComponent;
|
||||
|
@ -49,6 +50,7 @@ describe('PXEimagesComponent', () => {
|
|||
FormsModule,
|
||||
MatInputModule,
|
||||
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;
|
||||
|
@ -55,6 +56,7 @@ describe('PxeComponent', () => {
|
|||
MatSelect,
|
||||
MatOption,
|
||||
MatPaginator,
|
||||
MatProgressSpinnerModule,
|
||||
ToastrModule.forRoot(),
|
||||
TranslateModule.forRoot(),
|
||||
JoyrideModule.forRoot(),
|
||||
|
|
|
@ -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