Skip to content

Commit 1437772

Browse files
committed
test(book-data-http-service): deactivate all tests
1 parent e08c46b commit 1437772

File tree

1 file changed

+5
-38
lines changed

1 file changed

+5
-38
lines changed

src/app/book/shared/book-data.service.spec.ts

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,67 +8,34 @@ describe('BookStaticDataService', () => {
88
beforeEach(() => {
99
TestBed.configureTestingModule({
1010
providers: [BookDataService],
11-
imports: [HttpClientTestingModule]
11+
imports: []
1212
});
1313
});
1414

15-
// check after each test there is no pending(open) request
16-
afterEach(inject([HttpTestingController], (backend: HttpTestingController) => {
17-
backend.verify();
18-
}))
19-
2015
it('should be created', inject([BookDataService], (service: BookDataService) => {
2116
expect(service).toBeTruthy();
2217
}));
2318

2419
it('should return all books', inject([BookDataService, HttpTestingController],
2520
(service: BookDataService, backend: HttpTestingController) => {
26-
// call service method and test IN the subscription. no need to use async anymore!!
27-
service.getBooks()
28-
.subscribe(books => {
29-
expect(books).toEqual(staticBookData)
30-
});
31-
// Wait for the call and response with mockdata `.flush()`
32-
backend.expectOne('http://localhost:4730/books').flush(staticBookData, { status: 200, statusText: 'Ok' });
21+
expect(true).toBeFalsy();
3322
}));
3423

3524

3625
it('should return a single book', inject([BookDataService, HttpTestingController],
3726
(service: BookDataService, backend: HttpTestingController) => {
38-
// call service method and test IN the subscription. no need to use async anymore!!
39-
service.getBookByIsbn(staticBookData[0].isbn)
40-
.subscribe(books => {
41-
expect(books).toEqual(staticBookData[0])
42-
});
43-
// Wait for the call and response with mockdata `.flush()`
44-
backend.expectOne(`http://localhost:4730/books/${staticBookData[0].isbn}`).flush(staticBookData[0], { status: 200, statusText: 'Ok' });
27+
expect(true).toBeFalsy();
4528
}));
4629

4730

4831
it('should create a book with a post', inject([BookDataService, HttpTestingController],
4932
(service: BookDataService, backend: HttpTestingController) => {
50-
// call service method and test IN the subscription. no need to use async anymore!!
51-
service.createBook(staticBookData[0])
52-
.subscribe(books => {
53-
expect(books).toEqual(staticBookData[0])
54-
});
55-
// Wait for the call and response with mockdata `.flush()`
56-
backend
57-
.expectOne({ method: "POST", url: 'http://localhost:4730/books' })
58-
.flush(staticBookData[0], { status: 201, statusText: 'Created' });
33+
expect(true).toBeFalsy();
5934
}));
6035

6136
it('should update a book with a patch', inject([BookDataService, HttpTestingController],
6237
(service: BookDataService, backend: HttpTestingController) => {
63-
// call service method and test IN the subscription. no need to use async anymore!!
64-
service.updateBook(staticBookData[0].isbn, staticBookData[0])
65-
.subscribe(books => {
66-
expect(books).toEqual(staticBookData[0])
67-
});
68-
// Wait for the call and response with mockdata `.flush()`
69-
backend
70-
.expectOne({ method: "PATCH", url: `http://localhost:4730/books/${staticBookData[0].isbn}` })
71-
.flush(staticBookData[0]);
38+
expect(true).toBeFalsy();
7239
}));
7340
});
7441

0 commit comments

Comments
 (0)