|
1 | | -import { TestBed, inject } from '@angular/core/testing'; |
2 | | - |
3 | 1 | import { BookStaticDataService } from './book-static-data.service'; |
4 | 2 | import { Book } from './book'; |
5 | 3 |
|
6 | 4 | describe('BookStaticDataService', () => { |
7 | | - beforeEach(() => { |
8 | | - TestBed.configureTestingModule({ |
9 | | - providers: [BookStaticDataService] |
10 | | - }); |
11 | | - }); |
12 | 5 |
|
13 | | - it('should be created', inject([BookStaticDataService], (service: BookStaticDataService) => { |
14 | | - expect(service).toBeTruthy(); |
15 | | - })); |
| 6 | + it('should be created', () => { |
| 7 | + //expect(service).toBeTruthy(); |
| 8 | + expect(true).toBeFalsy(); |
| 9 | + }); |
16 | 10 |
|
17 | 11 | describe('getBooks()', () => { |
18 | | - it('should return the complete array of data', inject([BookStaticDataService], (service: BookStaticDataService) => { |
19 | | - expect(service.getBooks()).toBe(service.staticBookData); |
20 | | - })); |
| 12 | + it('should return the complete array of static data', () => { |
| 13 | + expect(true).toBeFalsy(); |
| 14 | + }); |
21 | 15 | }); |
22 | 16 |
|
23 | 17 | describe('getBook(isbn)', () => { |
24 | | - it('should return the first elemnt of data', inject([BookStaticDataService], (service: BookStaticDataService) => { |
25 | | - expect(service.getBook(123)).toBe(service.staticBookData[0]); |
26 | | - })); |
| 18 | + it('should always return the first element of data', () => { |
| 19 | + expect(true).toBeFalsy(); |
| 20 | + }); |
27 | 21 | }); |
28 | 22 |
|
29 | 23 | describe('getBook(book)', () => { |
30 | | - it('should return the book argument itself', inject([BookStaticDataService], (service: BookStaticDataService) => { |
31 | | - const book: Book = service.staticBookData[0]; |
32 | | - expect(service.updateBook(book)).toBe(book); |
33 | | - })); |
| 24 | + it('should return the given book argument itself', () => { |
| 25 | + expect(true).toBeFalsy(); |
| 26 | + }); |
34 | 27 | }); |
35 | 28 |
|
36 | 29 |
|
37 | 30 | describe('createBook(book)', () => { |
38 | | - it('should return the book argument itself', inject([BookStaticDataService], (service: BookStaticDataService) => { |
39 | | - const book: Book = { |
40 | | - 'title': 'The New Design Patterns', |
41 | | - 'subtitle': 'Elements of Reusable Object-Oriented Software', |
42 | | - 'isbn': '978-0-20163-361-0', |
43 | | - 'abstract': 'Capturing a wealth of experience about the design of object-oriented software, four top-notch designers present a catalog of simple and succinct solutions to commonly occurring design problems. Previously undocumented, these 23 patterns allow designers to create more flexible, elegant, and ultimately reusable designs without having to rediscover the design solutions themselves.', |
44 | | - 'numPages': 395, |
45 | | - 'author': 'Erich Gamma / Richard Helm / Ralph E. Johnson / John Vlissides', |
46 | | - 'publisher': { |
47 | | - 'name': 'Addison-Wesley', |
48 | | - 'url': 'http://www.addison-wesley.de/' |
49 | | - } |
50 | | - }; |
51 | | - expect(service.createBook(book)).toBe(book); |
52 | | - })); |
| 31 | + it('should return the book argument itself', () => { |
| 32 | + |
| 33 | + // const book: Book = { |
| 34 | + // 'title': 'The New Design Patterns', |
| 35 | + // 'subtitle': 'Elements of Reusable Object-Oriented Software', |
| 36 | + // 'isbn': '978-0-20163-361-0', |
| 37 | + // 'abstract': 'Capturing a wealth of experience about the design of object-oriented software, four top-notch designers present a catalog of simple and succinct solutions to commonly occurring design problems. Previously undocumented, these 23 patterns allow designers to create more flexible, elegant, and ultimately reusable designs without having to rediscover the design solutions themselves.', |
| 38 | + // 'numPages': 395, |
| 39 | + // 'author': 'Erich Gamma / Richard Helm / Ralph E. Johnson / John Vlissides', |
| 40 | + // 'publisher': { |
| 41 | + // 'name': 'Addison-Wesley', |
| 42 | + // 'url': 'http://www.addison-wesley.de/' |
| 43 | + // } |
| 44 | + // }; |
| 45 | + expect(true).toBeFalsy(); |
| 46 | + |
| 47 | + }); |
| 48 | + |
| 49 | + it('should add the new book to the dataset', () => { |
| 50 | + // const book: Book = { |
| 51 | + // 'title': 'The New Design Patterns', |
| 52 | + // 'subtitle': 'Elements of Reusable Object-Oriented Software', |
| 53 | + // 'isbn': '978-0-20163-361-0', |
| 54 | + // 'abstract': 'Capturing a wealth of experience about the design of object-oriented software, four top-notch designers present a catalog of simple and succinct solutions to commonly occurring design problems. Previously undocumented, these 23 patterns allow designers to create more flexible, elegant, and ultimately reusable designs without having to rediscover the design solutions themselves.', |
| 55 | + // 'numPages': 395, |
| 56 | + // 'author': 'Erich Gamma / Richard Helm / Ralph E. Johnson / John Vlissides', |
| 57 | + // 'publisher': { |
| 58 | + // 'name': 'Addison-Wesley', |
| 59 | + // 'url': 'http://www.addison-wesley.de/' |
| 60 | + // } |
| 61 | + // }; |
| 62 | + expect(true).toBeFalsy(); |
53 | 63 |
|
54 | | - it('should add the new book to the dataset', inject([BookStaticDataService], (service: BookStaticDataService) => { |
55 | | - const book: Book = { |
56 | | - 'title': 'The New Design Patterns', |
57 | | - 'subtitle': 'Elements of Reusable Object-Oriented Software', |
58 | | - 'isbn': '978-0-20163-361-0', |
59 | | - 'abstract': 'Capturing a wealth of experience about the design of object-oriented software, four top-notch designers present a catalog of simple and succinct solutions to commonly occurring design problems. Previously undocumented, these 23 patterns allow designers to create more flexible, elegant, and ultimately reusable designs without having to rediscover the design solutions themselves.', |
60 | | - 'numPages': 395, |
61 | | - 'author': 'Erich Gamma / Richard Helm / Ralph E. Johnson / John Vlissides', |
62 | | - 'publisher': { |
63 | | - 'name': 'Addison-Wesley', |
64 | | - 'url': 'http://www.addison-wesley.de/' |
65 | | - } |
66 | | - }; |
67 | | - service.createBook(book) |
68 | | - expect(service.staticBookData.length).toBe(4); |
69 | | - })); |
| 64 | + }); |
70 | 65 | }); |
71 | 66 |
|
72 | 67 | }); |
0 commit comments