fix: Fixed test units

This commit is contained in:
2025-06-04 16:24:18 +02:00
parent 9f97e584bd
commit c525dfe1c1
39 changed files with 632 additions and 82 deletions

View File

@@ -11,21 +11,35 @@ import { of } from 'rxjs';
import { MatTableModule } from '@angular/material/table';
import { MatInputModule } from '@angular/material/input';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
describe('AccountMgmtComponent', () => {
let component: AccountMgmtComponent;
let fixture: ComponentFixture<AccountMgmtComponent>;
let acMock
beforeEach(async () => {
const acMock = jasmine.createSpyObj("AdminCommService", {
getAccs: of()
})
acMock = {
accs: {
getAccs: jasmine.createSpy("getAccs").and.returnValue(of())
}
}
await TestBed.configureTestingModule({
declarations: [AccountMgmtComponent],
providers: [
{provide: AdminCommService, useValue: acMock}
],
imports: [MatDialogModule, MatSnackBarModule, MatFormFieldModule, MatIconModule, MatPaginatorModule, MatTableModule, MatInputModule, BrowserAnimationsModule]
imports: [
MatDialogModule,
MatSnackBarModule,
MatFormFieldModule,
MatIconModule,
MatPaginatorModule,
MatTableModule,
MatInputModule,
BrowserAnimationsModule,
MatProgressSpinnerModule
]
}).compileComponents();
fixture = TestBed.createComponent(AccountMgmtComponent);
component = fixture.componentInstance;

View File

@@ -3,21 +3,36 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserEditComponent } from './user-edit.component';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { ReactiveFormsModule } from '@angular/forms';
import { NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { AdminCommService } from '../../admin-comm.service';
import { forwardRef } from '@angular/core';
import { MatSelectModule } from '@angular/material/select';
describe('UserEditComponent', () => {
let component: UserEditComponent;
let fixture: ComponentFixture<UserEditComponent>;
let acMock
beforeEach(async () => {
acMock = {
}
await TestBed.configureTestingModule({
declarations: [UserEditComponent],
imports: [MatDialogModule, MatFormFieldModule, ReactiveFormsModule, MatInputModule, BrowserAnimationsModule],
imports: [
MatDialogModule,
MatFormFieldModule,
ReactiveFormsModule,
MatInputModule,
NoopAnimationsModule,
MatSelectModule
],
providers: [
{provide: MatDialogRef, useValue: {}},
{provide: MAT_DIALOG_DATA, useValue: {}}
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: { groups: [] } },
{ provide: AdminCommService, useValue: acMock },
]
}).compileComponents();
fixture = TestBed.createComponent(UserEditComponent);

View File

@@ -1,6 +1,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserResetComponent } from './user-reset.component';
import { MatDialogModule } from '@angular/material/dialog';
describe('UserResetComponent', () => {
let component: UserResetComponent;
@@ -8,7 +9,10 @@ describe('UserResetComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [UserResetComponent]
declarations: [UserResetComponent],
imports: [
MatDialogModule
]
});
fixture = TestBed.createComponent(UserResetComponent);
component = fixture.componentInstance;