-
Notifications
You must be signed in to change notification settings - Fork 241
Open
Description
original test:
const privateMethodSpy = component['privateMethod'] = jest.fn();
component.publicMethod();
expect(privateMethodSpy).toHaveBeenCalledTimes(1);
The original test runs without issue.
linted test:
const privateMethodSpy = jest.spyOn(component, 'privateMethod').mockImplementation();
component.publicMethod();
expect(privateMethodSpy).toHaveBeenCalledTimes(1);
The linted code fails to compile with "No overload matches this call".
No overload matches this call.
Overload 1 of 3, '(object: Component, method: never): SpyInstance<never, never, any>', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'never'.
Overload 2 of 3, '(object: Component, method: "ngOnInit" | "ngOnChanges" | "ngOnDestroy"): SpyInstance<void, [], any>', gave the following error.
Argument of type '"privateMethod"' is not assignable to parameter of type '"ngOnInit" | "ngOnChanges" | "ngOnDestroy"'.
ts(2769)
Metadata
Metadata
Assignees
Labels
No labels