Unit Testing stuff
This commit is contained in:
@@ -20,16 +20,9 @@ describe('AppComponent', () => {
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'Doppelkopf-Stats-Frontend'`, () => {
|
||||
it(`should have as title 'Doppelkopf-Stats'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('Doppelkopf-Stats-Frontend');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('.content span')?.textContent).toContain('Doppelkopf-Stats-Frontend app is running!');
|
||||
expect(app.title).toEqual('Doppelkopf-Stats');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,4 +20,8 @@ describe('HeaderComponent', () => {
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return the correct user name', () => {
|
||||
expect(component.getUserName()).toEqual('Logged out');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
@media (min-width: 768px) {
|
||||
#profile-popover {
|
||||
width: 15em;
|
||||
max-width: 15em;
|
||||
right: 1em;
|
||||
top: $header_height + 1em;
|
||||
border-radius: 1em;
|
||||
|
||||
@@ -12,8 +12,6 @@ export class ProfileComponent implements OnInit {
|
||||
@Input() user?: User;
|
||||
@Output() showProfilePopoverChange = new EventEmitter<boolean>();
|
||||
|
||||
isLoggedIn = true;
|
||||
|
||||
constructor(private eRef: ElementRef) {
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {HomeComponent} from './home.component';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
|
||||
const activatedRouteStub = {
|
||||
queryParams: {
|
||||
subscribe() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
@@ -8,7 +17,10 @@ describe('HomeComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [HomeComponent]
|
||||
declarations: [HomeComponent],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRouteStub }
|
||||
],
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user