first commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { TeamsComponent } from './teams.component';
|
||||
import { TeamsService } from './teams.service';
|
||||
|
||||
describe('TeamsComponent', () => {
|
||||
let component: TeamsComponent;
|
||||
let fixture: ComponentFixture<TeamsComponent>;
|
||||
const mockRoute = jasmine.createSpyObj('ActivatedRoute', ['']);
|
||||
const mockParam = jasmine.createSpyObj('P', ['get']);
|
||||
mockParam.get.and.returnValue('abc');
|
||||
mockRoute.snapshot = { paramMap: mockParam };
|
||||
|
||||
const mockTeamService = jasmine.createSpyObj('TeamsService', ['']);
|
||||
const mockRouter = jasmine.createSpyObj('Router', ['']);
|
||||
const mockHttp = jasmine.createSpyObj('HttpClient', ['get']);
|
||||
mockHttp.get.and.returnValue(of({}))
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TeamsComponent, MockOverviewComponent ],
|
||||
imports: [ MatProgressSpinnerModule ],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: mockRoute},
|
||||
{ provide: Router, useValue: mockRouter},
|
||||
{ provide: TeamsService, useValue: mockTeamService},
|
||||
{ provide: HttpClient, useValue: mockHttp},
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(TeamsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should load a team', () => {
|
||||
expect(component.teamsService.team).not.toBeNull();
|
||||
})
|
||||
});
|
||||
|
||||
@Component({
|
||||
selector: 'app-overview',
|
||||
template: '',
|
||||
})
|
||||
class MockOverviewComponent {
|
||||
}
|
||||
Reference in New Issue
Block a user