Skip to content

Commit aebc94e

Browse files
committed
test(book-list): add simple tests for book-list
1 parent ed436a4 commit aebc94e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/app/book/book-list/book-list.component.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,19 @@ describe('BookListComponent', () => {
3636
expect(component).toBeTruthy();
3737
});
3838

39+
it('should recieve 3 Books', () => {
40+
expect(compiled.querySelectorAll('.book-row').length).toBe(3);
41+
});
42+
43+
it('should display the title of each book', () => {
44+
expect(compiled.querySelectorAll('.book-row')[0].innerText).toContain('Design Patterns');
45+
expect(compiled.querySelectorAll('.book-row')[1].innerText).toContain('REST und HTTP');
46+
expect(compiled.querySelectorAll('.book-row')[2].innerText).toContain('Eloquent JavaScript');
47+
});
48+
49+
it('should link to the edit page of each book', () => {
50+
expect(compiled.querySelectorAll('.book-row a')[0].href).toContain('/978-0-20163-361-0');
51+
expect(compiled.querySelectorAll('.book-row a')[1].href).toContain('/978-3-86490-120-1');
52+
expect(compiled.querySelectorAll('.book-row a')[2].href).toContain('/978-1-59327-584-6');
53+
});
3954
});

0 commit comments

Comments
 (0)