-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
The following fails with a TypeError: foo.toString.mockReturnValue is not a function
:
interface Foo {
toString(): string;
}
const foo = mock<Foo>();
foo.toString.mockReturnValue('bar');
My guess for the issue is that mock
uses an empty object as a default first argument, which has the toString
default js method, and that causes jest-mock-extended
not to generate a jest.fn
for it.
FWIW, it can be worked around by just providing a different toString
to the default implementation:
const foo = mock<Foo>({
toString: () => 'bar',
});
Metadata
Metadata
Assignees
Labels
No labels