Add TaskOverview router test
parent
89f5b2d1ab
commit
cdc7a6f0e9
|
@ -1,9 +1,10 @@
|
|||
import {BlogComponent} from './blog.component'
|
||||
import {async, TestBed} from "@angular/core/testing";
|
||||
import {async, inject, TestBed} from "@angular/core/testing";
|
||||
import {RouterTestingModule} from "@angular/router/testing";
|
||||
import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core";
|
||||
import {Component, CUSTOM_ELEMENTS_SCHEMA} from "@angular/core";
|
||||
import {By} from "@angular/platform-browser";
|
||||
import {BlogEntryComponent} from "./blog-entry/blog-entry.component";;
|
||||
import {Router} from "@angular/router/router";
|
||||
|
||||
describe('Blog Component', () => {
|
||||
|
||||
|
|
|
@ -6,7 +6,10 @@ import {BaseRequestOptions, ConnectionBackend, Http, RequestMethod, ResponseOpti
|
|||
import {LoginService} from "./login-service";
|
||||
import {UserStore} from "../stores/user.store";
|
||||
|
||||
|
||||
/**
|
||||
* Initialisierung und Durchführung nach Vorlage aus dem
|
||||
* TaskService Tests (../task-service/task.service.spec.ts) von Christoph Höller
|
||||
*/
|
||||
describe('Login-Service', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
|
|
|
@ -199,5 +199,4 @@ describe('EditTask Component', () => {
|
|||
}));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
import {async, TestBed} from "@angular/core/testing";
|
||||
import {Router} from "@angular/router";
|
||||
import {ReactiveFormsModule} from "@angular/forms";
|
||||
import {inject} from "@angular/core/testing";
|
||||
import {TaskListComponent} from "./task-list.component";
|
||||
import {TaskItemComponent} from "./task-item.component";
|
||||
|
||||
import {RouterTestingModule} from "@angular/router/testing";
|
||||
import {MockTaskService} from "../../mocks/mock-task-service";
|
||||
import {TaskService} from "../../services/task-service/task.service";
|
||||
|
||||
|
||||
|
||||
describe('Task Overview Component Routing', () => {
|
||||
let component: TaskListComponent;
|
||||
let fixture;
|
||||
let router;
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ReactiveFormsModule, RouterTestingModule.withRoutes([])],
|
||||
declarations: [TaskListComponent, TaskItemComponent],
|
||||
providers: [ {provide: TaskService, useClass: MockTaskService}
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(TaskListComponent);
|
||||
component = fixture.componentInstance;
|
||||
}));
|
||||
|
||||
beforeEach(inject([Router],
|
||||
(_router) => {
|
||||
router = _router;
|
||||
})
|
||||
);
|
||||
|
||||
it('should call Router.navigate with id to open quickedit ',() => {
|
||||
fixture.whenStable().then(() => {
|
||||
let taskId = 12;
|
||||
|
||||
let spyNavigation = spyOn(router, 'navigate');
|
||||
|
||||
component.selectTask(taskId);
|
||||
expect(spyNavigation).toHaveBeenCalled();
|
||||
expect(spyNavigation.calls.first().args[0])
|
||||
.toContain({outlets: {'right': ['overview', taskId]}});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue