From a82165e3f980c550c154c5e1691dc025faf868b8 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 26 Jan 2022 15:20:00 +0100 Subject: [PATCH] test(docs-infra): fix type checking errors with new jasmine types (#44735) The jasmine types for `spyObj.calls().all()` seem to be more specific, relying on `ThisType` to determine the context/receiver for an invoked spy. This type does not work as expected with class members as it seems. This commit fixes three of these type checking failures by explicitly casting the spy context to the actual class owning the method member. PR Close #44735 --- aio/src/app/shared/scroll-spy.service.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aio/src/app/shared/scroll-spy.service.spec.ts b/aio/src/app/shared/scroll-spy.service.spec.ts index b17e279fc32..145d288a5ba 100644 --- a/aio/src/app/shared/scroll-spy.service.spec.ts +++ b/aio/src/app/shared/scroll-spy.service.spec.ts @@ -54,9 +54,9 @@ describe('ScrollSpiedElementGroup', () => { const callInfo = spy.calls.all(); expect(spy).toHaveBeenCalledTimes(3); - expect(callInfo[0].object.index).toBe(0); - expect(callInfo[1].object.index).toBe(1); - expect(callInfo[2].object.index).toBe(2); + expect((callInfo[0].object as ScrollSpiedElement).index).toBe(0); + expect((callInfo[1].object as ScrollSpiedElement).index).toBe(1); + expect((callInfo[2].object as ScrollSpiedElement).index).toBe(2); expect(callInfo[0].args).toEqual([20, 10]); expect(callInfo[1].args).toEqual([20, 10]); expect(callInfo[2].args).toEqual([20, 10]);