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

mockReturnValue overwrites mockImplementation #3928

Closed
aaronabramov opened this issue Jun 28, 2017 · 1 comment · Fixed by #3933
Closed

mockReturnValue overwrites mockImplementation #3928

aaronabramov opened this issue Jun 28, 2017 · 1 comment · Fixed by #3933

Comments

@aaronabramov
Copy link
Contributor

aaronabramov commented Jun 28, 2017

  test('mockImplementation && mockReturnValue', () => {
    const fn = jest.fn();
    expect(fn()).toBeUndefined();
    fn.mockReturnValue('returnValue');
    fn.mockImplementation(() => 'foo');
    expect(fn()).toBe('foo'); // fails because: fn() => 'returnValue'
  });

i'm not sure if this is expected or not. The behavior was different in jest@19

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant