hirezio / auto-spies

Create automatic spies from classes
MIT License
181 stars 30 forks source link

Working tests fail after upgrade to Angular 13 with strict typing #56

Closed hokrc01 closed 2 years ago

hokrc01 commented 2 years ago

Describe the bug

Error: projects/admin/src/app/services/event-runner.service.spec.ts:178:33 - error TS2339: Property 'nextWith' does not exist on type 'SpyAnd | (SpyAnd & AddPromiseSpyMethods) | (SpyAnd & AddObservableSpyMethods)'. Property 'nextWith' does not exist on type 'SpyAnd'.

178 apiServiceSpy.fetch.and.nextWith(fakeResponse);

To Reproduce Sample code :

const setPayload = (payload:any) => {
      const fakeResponse = payload;
      apiServiceSpy.fetch.and.nextWith(fakeResponse);
    };

Expected behavior This test sample ran under 11. As a work around, I have blanked it out. In doing so, I have lost most of my existing tests

shairez commented 2 years ago

Without seeing the whole code I cannot trace down the problem Can you please upload a sample project to github that simulates this issue?

shairez commented 2 years ago

Closing this for lack of response when you'll have time to reproduce and maybe share a repo, you can re-open

thanks