From 0ca196d7848c494571b3173389aa115aceaedbe4 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Wed, 7 Jul 2021 14:36:03 +0300 Subject: [PATCH] test(docs-infra): prevent warning due to missing expectation (#42776) Fix a unit test warning due to Jasmine not realizing that `httpMock.expectOne()` is an expectation. [Example][1]: > WARN: 'Spec 'DocumentService currentDocument should encode the request > path to be case-insensitive' has no expectations.' [1]: https://circleci.com/gh/angular/angular/1017640 PR Close #42776 --- aio/src/app/documents/document.service.spec.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/aio/src/app/documents/document.service.spec.ts b/aio/src/app/documents/document.service.spec.ts index 8b083e391b..6ea5132a6c 100644 --- a/aio/src/app/documents/document.service.spec.ts +++ b/aio/src/app/documents/document.service.spec.ts @@ -70,13 +70,16 @@ describe('DocumentService', () => { it('should encode the request path to be case-insensitive', () => { const { docService, locationService } = getServices('initial/Doc'); docService.currentDocument.subscribe(); - httpMock.expectOne(CONTENT_URL_PREFIX + 'initial/d_oc.json').flush({}); - locationService.go('NEW/Doc'); - httpMock.expectOne(CONTENT_URL_PREFIX + 'n_e_w_/d_oc.json').flush({}); - locationService.go('doc_with_underscores'); - httpMock.expectOne(CONTENT_URL_PREFIX + 'doc__with__underscores.json').flush({}); - locationService.go('DOC_WITH_UNDERSCORES'); - httpMock.expectOne(CONTENT_URL_PREFIX + 'd_o_c___w_i_t_h___u_n_d_e_r_s_c_o_r_e_s_.json').flush({}); + + expect(() => { + httpMock.expectOne(CONTENT_URL_PREFIX + 'initial/d_oc.json').flush({}); + locationService.go('NEW/Doc'); + httpMock.expectOne(CONTENT_URL_PREFIX + 'n_e_w_/d_oc.json').flush({}); + locationService.go('doc_with_underscores'); + httpMock.expectOne(CONTENT_URL_PREFIX + 'doc__with__underscores.json').flush({}); + locationService.go('DOC_WITH_UNDERSCORES'); + httpMock.expectOne(CONTENT_URL_PREFIX + 'd_o_c___w_i_t_h___u_n_d_e_r_s_c_o_r_e_s_.json').flush({}); + }).not.toThrow(); }); it('should emit the not-found document if the document is not found on the server', () => {