Skip to content

Commit 55721eb

Browse files
committed
Angular Testing Course
1 parent 07bc04c commit 55721eb

8 files changed

+114
-495
lines changed

src/app/app.component.spec.ts

-57
This file was deleted.

src/app/courses/course/course.component.spec.ts

-73
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
2+
import {CoursesCardListComponent} from './courses-card-list.component';
3+
import {CoursesModule} from '../courses.module';
4+
import {COURSES} from '../../../../server/db-data';
5+
import {DebugElement} from '@angular/core';
6+
import {By} from '@angular/platform-browser';
7+
import {sortCoursesBySeqNo} from '../home/sort-course-by-seq';
8+
import {Course} from '../model/course';
9+
import {setupCourses} from '../common/setup-test-data';
10+
11+
12+
13+
14+
describe('CoursesCardListComponent', () => {
15+
16+
17+
it("should create the component", () => {
18+
19+
pending();
20+
21+
});
22+
23+
24+
it("should display the course list", () => {
25+
26+
pending();
27+
28+
});
29+
30+
31+
it("should display the first course", () => {
32+
33+
pending();
34+
35+
});
36+
37+
38+
});
39+
40+

src/app/courses/courses-card-list/courses-card-list.component.spec.ts

-85
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import {async, ComponentFixture, fakeAsync, flush, flushMicrotasks, TestBed} from '@angular/core/testing';
2+
import {CoursesModule} from '../courses.module';
3+
import {DebugElement} from '@angular/core';
4+
5+
import {HomeComponent} from './home.component';
6+
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
7+
import {CoursesService} from '../services/courses.service';
8+
import {HttpClient} from '@angular/common/http';
9+
import {COURSES} from '../../../../server/db-data';
10+
import {setupCourses} from '../common/setup-test-data';
11+
import {By} from '@angular/platform-browser';
12+
import {of} from 'rxjs';
13+
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
14+
import {click} from '../common/test-utils';
15+
16+
17+
18+
19+
describe('HomeComponent', () => {
20+
21+
let fixture: ComponentFixture<HomeComponent>;
22+
let component:HomeComponent;
23+
let el: DebugElement;
24+
25+
beforeEach((() => {
26+
27+
28+
}));
29+
30+
31+
beforeEach(() => {
32+
fixture = TestBed.createComponent(HomeComponent);
33+
component = fixture.componentInstance;
34+
el = fixture.debugElement;
35+
});
36+
37+
38+
it("should create the component", () => {
39+
40+
expect(component).toBeTruthy();
41+
42+
});
43+
44+
45+
it("should display only beginner courses", () => {
46+
47+
pending();
48+
49+
});
50+
51+
52+
it("should display only advanced courses", () => {
53+
54+
pending();
55+
56+
});
57+
58+
59+
it("should display both tabs", () => {
60+
61+
pending();
62+
63+
});
64+
65+
66+
it("should display advanced courses when tab clicked", () => {
67+
68+
pending();
69+
70+
});
71+
72+
});
73+
74+

0 commit comments

Comments
 (0)