Skip to content

Allow setting default after training #59

@narthur

Description

@narthur

Would it be possible to make it so that you could set or replace the default return value without also resetting previously-added training? Basically, could jest-when be modified to make the following test pass?

it('can add default after training, reduced', async () => {
  const fn = jest.fn();
  
  when(fn).calledWith(1).mockReturnValue('a');
  
  fn.mockReturnValue('b');
  
  expect(fn(1)).toEqual('a');
  expect(fn(2)).toEqual('b');
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions