Unit Tests Frontend

This commit is contained in:
Bastian Wagner
2026-03-11 14:41:57 +01:00
parent 1480e8d7b2
commit 5a15847c4a
18 changed files with 211 additions and 342 deletions

View File

@@ -1,6 +1,5 @@
import { inject, Injectable } from "@angular/core";
import { ActivatedRouteSnapshot, Router } from "@angular/router";
import { HotToastService } from "@ngxpert/hot-toast";
import { AuthService } from "./auth.service";
@Injectable({
@@ -9,7 +8,6 @@ import { AuthService } from "./auth.service";
export class AuthenticatedGuard {
public isLoading = false;
private router = inject(Router);
private toast = inject(HotToastService);
private authService = inject(AuthService);
async canActivate(route: ActivatedRouteSnapshot):

View File

@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CylinderArchiveComponent } from './cylinder-archive.component';
describe('CylinderArchiveComponent', () => {
let component: CylinderArchiveComponent;
let fixture: ComponentFixture<CylinderArchiveComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CylinderArchiveComponent]
})
.compileComponents();
fixture = TestBed.createComponent(CylinderArchiveComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,20 @@
<h2 mat-dialog-title>Schlüssel <u>{{key.name}}</u> löschen?</h2>
<mat-dialog-content>
<div class="warning-message">
<mat-icon>warning</mat-icon>
<p>
<b>{{key.name}}</b> wirklich endgültig löschen?
</p>
<p class="additional-info">
<!-- Additional information -->
<small>Gelöschte Schlüssel können nicht mehr wiederhergestellt werden</small>
</p>
</div>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button matButton [mat-dialog-close]="false">Abbrechen</button>
<button matButton="elevated" [mat-dialog-close]="true" class="btn-warning">
<mat-icon>delete</mat-icon>
Entfernen
</button>
</mat-dialog-actions>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DeleteKeyFromArchiveComponent } from './delete-key-from-archive.component';
describe('DeleteKeyFromArchiveComponent', () => {
let component: DeleteKeyFromArchiveComponent;
let fixture: ComponentFixture<DeleteKeyFromArchiveComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [DeleteKeyFromArchiveComponent]
})
.compileComponents();
fixture = TestBed.createComponent(DeleteKeyFromArchiveComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,18 @@
import { Component, inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
import { IKey } from '../../../../../model/interface/key.interface';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
@Component({
selector: 'app-delete-key-from-archive',
imports: [MatDialogModule, MatButtonModule, MatIconModule],
templateUrl: './delete-key-from-archive.component.html',
styleUrl: './delete-key-from-archive.component.scss',
})
export class DeleteKeyFromArchiveComponent {
readonly dialogRef = inject(MatDialogRef<DeleteKeyFromArchiveComponent>);
readonly key = inject<IKey>(MAT_DIALOG_DATA);
}

View File

@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MultipleCylinderSystemsDialogComponent } from './multiple-cylinder-systems-dialog.component';
describe('MultipleCylinderSystemsDialogComponent', () => {
let component: MultipleCylinderSystemsDialogComponent;
let fixture: ComponentFixture<MultipleCylinderSystemsDialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [MultipleCylinderSystemsDialogComponent]
})
.compileComponents();
fixture = TestBed.createComponent(MultipleCylinderSystemsDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SystemArchiveComponent } from './system-archive.component';
describe('SystemArchiveComponent', () => {
let component: SystemArchiveComponent;
let fixture: ComponentFixture<SystemArchiveComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SystemArchiveComponent]
})
.compileComponents();
fixture = TestBed.createComponent(SystemArchiveComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { AgGridService } from './ag-grid.service';
describe('AgGridService', () => {
let service: AgGridService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(AgGridService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AgDeleteSystemComponent } from './ag-delete-system.component';
describe('AgDeleteSystemComponent', () => {
let component: AgDeleteSystemComponent;
let fixture: ComponentFixture<AgDeleteSystemComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AgDeleteSystemComponent]
})
.compileComponents();
fixture = TestBed.createComponent(AgDeleteSystemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AgGridContainerComponent } from './ag-grid-container.component';
describe('AgGridContainerComponent', () => {
let component: AgGridContainerComponent;
let fixture: ComponentFixture<AgGridContainerComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AgGridContainerComponent]
})
.compileComponents();
fixture = TestBed.createComponent(AgGridContainerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,12 +1 @@
import 'zone.js/testing';
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
// Wichtig: Initialisiert Angulars Test-Environment (wie früher in test.ts)
TestBed.initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
import '@angular/compiler';