Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

Commit 9f2a2d1

Browse files
author
Gregor Woiwode
committed
Tests if the book is initialized with a rating of 0
1 parent 6c50c95 commit 9f2a2d1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

book-rating/src/app/shared/book.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import {Book} from './book';
99

1010
describe('Book', () => {
1111
it('should create an instance', () => {
12-
expect(new Book()).toBeTruthy();
12+
expect(new Book('a', 'b', 1)).toBeTruthy();
13+
});
14+
15+
it('has a rating of 0', () => {
16+
expect(new Book('a', 'b').rating).toEqual(0);
1317
});
1418
});

book-rating/src/app/shared/book.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export class Book {
22
constructor(public title: string,
33
public description: string,
4-
public rating: number) { }
4+
public rating: number = 0) { }
55
}

0 commit comments

Comments
 (0)