Skip to content

Commit c5fa13c

Browse files
committed
Update courses.service.spec.ts
1 parent 2d88a89 commit c5fa13c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/app/courses/services/courses.service.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
HttpTestingController,
44
} from "@angular/common/http/testing";
55
import { TestBed } from "@angular/core/testing";
6-
import { COURSES } from "../../../../server/db-data";
6+
import { COURSES, findCourseById } from '../../../../server/db-data';
77
import { CoursesService } from "./courses.service";
88
describe("CoursesService", () => {
99
let coursesService: CoursesService,
@@ -34,4 +34,12 @@ describe("CoursesService", () => {
3434
// passing some test data to our mock request
3535
req.flush({ payload: Object.values(COURSES) });
3636
});
37+
38+
it("should find a course by id", () => {
39+
coursesService.findCourseById(12).subscribe((course) => {
40+
expect(course).toBeTruthy("No courses returned");
41+
expect(course.id).toBe(12, "incorrect course id");
42+
43+
44+
});
3745
});

0 commit comments

Comments
 (0)