Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ describe('workspace-project App', () => {
page = new AppPage();
});

it('should display welcome message', () => {
it('should find router-outlet html tag in DOM', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to app!');
expect(page.getRouterOutletTag()).toBeTruthy();
});
});
4 changes: 2 additions & 2 deletions e2e/src/app.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class AppPage {
return browser.get('/');
}

getParagraphText() {
return element(by.css('app-root h1')).getText();
getRouterOutletTag() {
return element(by.css('app-root router-outlet')).isPresent();
}
}
4 changes: 2 additions & 2 deletions src/app/api.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TestBed, inject } from '@angular/core/testing';

import { HttpClient, HttpHandler } from '@angular/common/http';
import { ApiService } from './api.service';

describe('ApiService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [ApiService]
providers: [ApiService, HttpClient, HttpHandler]
});
});

Expand Down
7 changes: 5 additions & 2 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
Expand All @@ -6,6 +7,7 @@ describe('AppComponent', () => {
declarations: [
AppComponent
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
}).compileComponents();
}));
it('should create the app', async(() => {
Expand All @@ -18,10 +20,11 @@ describe('AppComponent', () => {
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
}));
it('should render title in a h1 tag', async(() => {

it('should render router-outlet tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
expect(compiled.querySelector('router-outlet').tagName).toContain('ROUTER-OUTLET');
}));
});
11 changes: 9 additions & 2 deletions src/app/book-create/book-create.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { MatInputModule } from '@angular/material';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { RouterTestingModule } from '@angular/router/testing';
import { BookCreateComponent } from './book-create.component';

describe('BookCreateComponent', () => {
Expand All @@ -8,7 +13,9 @@ describe('BookCreateComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ BookCreateComponent ]
imports: [ RouterTestingModule, ReactiveFormsModule, HttpClientModule, MatInputModule, BrowserAnimationsModule ],
declarations: [ BookCreateComponent ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
.compileComponents();
}));
Expand Down
9 changes: 7 additions & 2 deletions src/app/book-detail/book-detail.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { RouterTestingModule } from '@angular/router/testing';
import { BookDetailComponent } from './book-detail.component';

describe('BookDetailComponent', () => {
Expand All @@ -8,7 +11,9 @@ describe('BookDetailComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ BookDetailComponent ]
imports: [ RouterTestingModule, ReactiveFormsModule, HttpClientModule ],
declarations: [ BookDetailComponent ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
.compileComponents();
}));
Expand Down
11 changes: 9 additions & 2 deletions src/app/book-edit/book-edit.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { MatInputModule } from "@angular/material";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { RouterTestingModule } from '@angular/router/testing';
import { BookEditComponent } from './book-edit.component';

describe('BookEditComponent', () => {
Expand All @@ -8,7 +13,9 @@ describe('BookEditComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ BookEditComponent ]
imports: [ RouterTestingModule, ReactiveFormsModule, HttpClientModule, MatInputModule, BrowserAnimationsModule ],
declarations: [ BookEditComponent ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
.compileComponents();
}));
Expand Down
10 changes: 8 additions & 2 deletions src/app/book/book.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { MatTableModule } from '@angular/material';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { RouterTestingModule } from '@angular/router/testing';
import { BookComponent } from './book.component';

describe('BookComponent', () => {
Expand All @@ -8,7 +12,9 @@ describe('BookComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ BookComponent ]
imports: [ RouterTestingModule, ReactiveFormsModule, HttpClientModule, MatTableModule ],
declarations: [ BookComponent ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
.compileComponents();
}));
Expand Down