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

Is it possible to make multiple hot mock updates? #125

Open
s-maheshbabu opened this issue Nov 27, 2020 · 2 comments
Open

Is it possible to make multiple hot mock updates? #125

s-maheshbabu opened this issue Nov 27, 2020 · 2 comments
Assignees

Comments

@s-maheshbabu
Copy link

Hot mock update appears to work the first time and only the first time. Is it possible to make multiple hot mock updates? Is the following expected to work?

rewiremock('./foo')
  .callThrough()
  .with({ action1: action1Stub1 })
  .dynamic();

 const foo = require('./foo');
 foo.action == action1Stub1;
 
 rewiremock.getMock('./foo')
   .with({ action1: action1Stub2 });
 foo.action == action1Stub2;
 
 rewiremock.getMock('./foo')
   .with({ action1: action1Stub3 });
 foo.action == action1Stub3;
@theKashey
Copy link
Owner

Not very sure about this operation - foo.action == action1Stub1;. It actually shall throw a little as there is no "set" operation defined at all.

Anyway - you've got a pretty simple use case, and the best I can do - create unit test from it.
It will explain what is not working in the best possible way.

@theKashey theKashey self-assigned this Nov 27, 2020
@s-maheshbabu
Copy link
Author

I made a mistake with scopes. I was able to get multiple hot mock updates working just fine.

I will leave the issue open if you want to put a unit test in place but please consider this closed from my end. Thanks for building this library.

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

No branches or pull requests

2 participants