mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2026-04-27 15:50:11 +00:00
Adjusting some frontend tests
This commit is contained in:
@@ -1,25 +1,53 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import { KundenComponent } from './kunden.component';
|
||||
import {KundenComponent} from './kunden.component';
|
||||
import {AbstractMockObservableService} from '../../mocks/mock.service';
|
||||
import {ApiService} from '../../services/api.service';
|
||||
import {ActivatedRoute, convertToParamMap, Router} from '@angular/router';
|
||||
import {of} from 'rxjs';
|
||||
|
||||
class MockApiService extends AbstractMockObservableService {
|
||||
getProducts(): any {
|
||||
this.content = [];
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
class ActivatedRouteMock {
|
||||
public paramMap = of(convertToParamMap({
|
||||
testId: 'abc123',
|
||||
anotherId: 'd31e8b48-7309-4c83-9884-4142efdf7271',
|
||||
}));
|
||||
}
|
||||
|
||||
describe('KundenComponent', () => {
|
||||
let component: KundenComponent;
|
||||
let fixture: ComponentFixture<KundenComponent>;
|
||||
let component: KundenComponent;
|
||||
let fixture: ComponentFixture<KundenComponent>;
|
||||
let mockService;
|
||||
const router = {
|
||||
navigate: jasmine.createSpy('navigate'),
|
||||
routerState: jasmine.createSpy('routerState')
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ KundenComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
beforeEach(async () => {
|
||||
mockService = new MockApiService();
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [KundenComponent],
|
||||
providers: [{provide: ApiService, useValue: mockService}, {provide: Router, useValue: router}, {
|
||||
provide: ActivatedRoute,
|
||||
useValue: ActivatedRouteMock
|
||||
}]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(KundenComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(KundenComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user