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<Fn>` 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
This commit is contained in:
Paul Gschwendtner
2022-01-26 15:20:00 +01:00
committed by Jessica Janiuk
parent 362e07ba92
commit a82165e3f9
@@ -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]);