While upgrading Angular (via Nx/NRWL) from 11 to 12, tests started to fail due to: Property 'and' does not exist on type 'SpyInstance<{ afterClosed: () => Observable<{ snoozeDate: Moment; snoozeNote: string; }>; }, []>'.
There are ~30 some tests that use the .and.returnValue.
Examples:
jest.spyOn(mockMatDialog, 'open').and.returnValue({ afterClosed: () => of(true)});
,jest.spyOn(component.randomHelperService, 'myHelper').and.returnValue('12354');
What is the best way to replace this "returnValue" behavior? FYI, I have this set too, testRunner: 'jest-jasmine2',
in order to make other syntax work after the upgrade.