diff options
author | crupest <crupest@outlook.com> | 2019-03-06 21:29:36 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-03-06 21:29:36 +0800 |
commit | 63735a8267d44892a64da5b599b7c2e20f373464 (patch) | |
tree | 7f43f0beb8c465e06e0d1c4d18cadfb77c39bc78 /Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts | |
parent | 8ec742c4a00c1732d6aa58a1cb8b628428d23c4a (diff) | |
download | timeline-63735a8267d44892a64da5b599b7c2e20f373464.tar.gz timeline-63735a8267d44892a64da5b599b7c2e20f373464.tar.bz2 timeline-63735a8267d44892a64da5b599b7c2e20f373464.zip |
Reorganize file structure.
Diffstat (limited to 'Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts b/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts deleted file mode 100644 index 5706bf51..00000000 --- a/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; - -import { Observable, from } from 'rxjs'; - -import { TodoListPageComponent } from './todo-list-page.component'; -import { TodoListService, TodoItem } from './todo-list.service'; -import { By } from '@angular/platform-browser'; -import { delay } from 'rxjs/operators'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -@Component({ - /* tslint:disable-next-line:component-selector*/ - selector: 'mat-progress-bar', - template: '' -}) -class MatProgressBarStubComponent {} - -function asyncArray<T>(data: T[]): Observable<T> { - return from(data).pipe(delay(0)); -} - -describe('TodoListPageComponent', () => { - let component: TodoListPageComponent; - let fixture: ComponentFixture<TodoListPageComponent>; - - const mockTodoItems: TodoItem[] = [ - { - number: 0, - title: 'Test title 1', - isClosed: true, - detailUrl: 'test_url1' - }, - { - number: 1, - title: 'Test title 2', - isClosed: false, - detailUrl: 'test_url2' - } - ]; - - beforeEach(async(() => { - const todoListService: jasmine.SpyObj<TodoListService> = jasmine.createSpyObj('TodoListService', ['getWorkItemList']); - - todoListService.getWorkItemList.and.returnValue(asyncArray(mockTodoItems)); - - TestBed.configureTestingModule({ - declarations: [TodoListPageComponent, MatProgressBarStubComponent], - imports: [NoopAnimationsModule], - providers: [{ provide: TodoListService, useValue: todoListService }], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TodoListPageComponent); - component = fixture.componentInstance; - }); - - it('should create', () => { - fixture.detectChanges(); - expect(component).toBeTruthy(); - }); - - it('should show progress bar during loading', () => { - fixture.detectChanges(); - expect(fixture.debugElement.query(By.css('mat-progress-bar'))).toBeTruthy(); - }); - - it('should hide progress bar after loading', fakeAsync(() => { - fixture.detectChanges(); - tick(); - fixture.detectChanges(); - expect(fixture.debugElement.query(By.css('mat-progress-bar'))).toBeFalsy(); - })); -}); |