Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 36865fe

Browse filesBrowse files
committed
fix(test): resolve typescript errors
1 parent b3248ff commit 36865fe
Copy full SHA for 36865fe

File tree

Expand file treeCollapse file tree

2 files changed

+20
-22
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-22
lines changed

‎src/app/book/book-detail/book-detail.component.spec.ts

Copy file name to clipboardExpand all lines: src/app/book/book-detail/book-detail.component.spec.ts
+7-9Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { RouterTestingModule } from '@angular/router/testing';
2-
import { BookStaticAsyncDataService } from './../shared/book-static-async-data.service';
1+
import { Location } from '@angular/common';
2+
import { Directive, Input } from '@angular/core';
3+
import { ComponentFixture, inject, TestBed } from '@angular/core/testing';
4+
import { ActivatedRoute, Router } from '@angular/router';
5+
import { of } from 'rxjs';
36
import { BookDataService } from '../shared/book-data.service';
4-
import { ComponentFixture, TestBed, inject } from '@angular/core/testing';
5-
7+
import { BookStaticAsyncDataService } from './../shared/book-static-async-data.service';
68
import { BookDetailComponent } from './book-detail.component';
7-
import { DebugElement, Component, Directive, Input } from '@angular/core';
8-
import { ActivatedRoute, Router } from '@angular/router';
9-
import { Location } from '@angular/common';
10-
import { Observable } from 'rxjs';
119

1210
// Disable RouterLink for this test
1311
@Directive({
@@ -39,7 +37,7 @@ describe('BookDetailComponent', () => {
3937
{ provide: BookDataService, useClass: BookStaticAsyncDataService },
4038
{
4139
provide: ActivatedRoute,
42-
useValue: { params: Observable.of({ isbn: '978-0-20163-361-0' }) }
40+
useValue: { params: of({ isbn: '978-0-20163-361-0' }) }
4341
}
4442
]
4543
}).compileComponents();

‎src/app/book/book-new/book-new.component.spec.ts

Copy file name to clipboardExpand all lines: src/app/book/book-new/book-new.component.spec.ts
+13-13Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import { RouterTestingModule } from '@angular/router/testing';
2-
import { BookStaticAsyncDataService } from './../shared/book-static-async-data.service';
3-
import { BookDataService } from '../shared/book-data.service';
41
import {
5-
ComponentFixture,
6-
TestBed,
72
async,
8-
inject
3+
ComponentFixture,
4+
inject,
5+
TestBed
96
} from '@angular/core/testing';
10-
7+
import {
8+
AbstractControl,
9+
FormsModule,
10+
ReactiveFormsModule
11+
} from '@angular/forms';
12+
import { RouterTestingModule } from '@angular/router/testing';
13+
import { BookDataService } from '../shared/book-data.service';
14+
import { BookStaticAsyncDataService } from './../shared/book-static-async-data.service';
1115
import { BookNewComponent } from './book-new.component';
12-
import { DebugElement } from '@angular/core';
13-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
1416

1517
describe('BookNewComponent', () => {
1618
let component: BookNewComponent;
@@ -48,10 +50,8 @@ describe('BookNewComponent', () => {
4850
});
4951

5052
it('should require title', () => {
51-
let errors = {};
52-
const title = component.form.controls.title;
53-
errors = title.errors || {};
54-
expect(errors.required).toBeTruthy();
53+
const title: AbstractControl = component.form.controls.title;
54+
expect(title.errors.required).toBeTruthy();
5555
});
5656

5757
it('should call createBook on submit', inject(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.