unit tests
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AgSystemManagerComponent } from './ag-system-manager.component';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { AgGridAngular } from 'ag-grid-angular';
|
||||
import { ApiService } from '../../../api.service';
|
||||
import { of } from 'rxjs';
|
||||
import { HotToastService } from '@ngxpert/hot-toast';
|
||||
|
||||
describe('AgSystemManagerComponent', () => {
|
||||
let component: AgSystemManagerComponent;
|
||||
let fixture: ComponentFixture<AgSystemManagerComponent>;
|
||||
let mockApiService: MockApiService;
|
||||
|
||||
const mockHotToastService = {
|
||||
observe: jest.fn().mockImplementation(() => ({
|
||||
loading: 'speichern...',
|
||||
success: 'Änderungen gespeichert',
|
||||
error: 'Änderungen konnten nicht gespeichert werden!',
|
||||
subscribe: jest.fn().mockReturnValue(of([]))
|
||||
}))
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
mockApiService = new MockApiService();
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AgSystemManagerComponent, AgGridAngular, MatDialogModule],
|
||||
providers: [
|
||||
{ provide: ApiService, useValue: mockApiService },
|
||||
{ provide: HotToastService, useValue: mockHotToastService },
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AgSystemManagerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
class MockApiService {
|
||||
getSystems = jest.fn();
|
||||
}
|
||||
Reference in New Issue
Block a user