Skip to content

Commit 4eabb59

Browse files
author
Your Name
committed
Angular Testing Course
1 parent f153f29 commit 4eabb59

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

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

+14-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ describe('CoursesService', () => {
5151

5252
});
5353

54-
5554
it('should find a course by id', () => {
5655

5756
coursesService.findCourseById(12)
@@ -74,7 +73,8 @@ describe('CoursesService', () => {
7473

7574
it('should save the course data', () => {
7675

77-
const changes :Partial<Course> = {titles:{description: 'Testing Course'}};
76+
const changes :Partial<Course> =
77+
{titles:{description: 'Testing Course'}};
7878

7979
coursesService.saveCourse(12, changes)
8080
.subscribe(course => {
@@ -83,6 +83,18 @@ describe('CoursesService', () => {
8383

8484
});
8585

86+
const req = httpTestingController.expectOne('/api/courses/12');
87+
88+
expect(req.request.method).toEqual("PUT");
89+
90+
expect(req.request.body.titles.description)
91+
.toEqual(changes.titles.description);
92+
93+
req.flush({
94+
...COURSES[12],
95+
...changes
96+
})
97+
8698
});
8799

88100

0 commit comments

Comments
 (0)