Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested objects aren't typed as DeepMocked #885

Open
NickBolles opened this issue Dec 16, 2024 · 0 comments · May be fixed by #884
Open

Nested objects aren't typed as DeepMocked #885

NickBolles opened this issue Dec 16, 2024 · 0 comments · May be fixed by #884

Comments

@NickBolles
Copy link

export class MyClass {
  foo = {
    bar: () => {
      return 'foo.bar';
    },
  };
}

test('foo.bar', () => {
  const myMock = createMock<MyClass>();

  myMock.foo.bar.mockResolvedValue('foo.bar');
});
image

Based off the createMock source this nested object should also be a mock. Updating the typings as suggested in #884 fixes this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant