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

Hydrated mock with undefined object values as parameter #746

Closed
C0ZEN opened this issue May 20, 2021 · 3 comments · Fixed by #748
Closed

Hydrated mock with undefined object values as parameter #746

C0ZEN opened this issue May 20, 2021 · 3 comments · Fixed by #748
Assignees
Labels

Comments

@C0ZEN
Copy link
Contributor

C0ZEN commented May 20, 2021

Subject of the issue

I noticed on subtle change between the createMock and createHydratedMock functions.
Following my last comment #699.
Should fix Sonia-corporation/sonia-discord#1383

Your environment

  • ts-auto-mock version: 3.2.1
  • typescript version: 4.2.4
  • node version: 14.17.0
  • npm version: 7.12.1
  • jest-ts-auto-mock: 2.0.0

Steps to reproduce

No problem, the features will stay undefined.

channel = createMock<IFirebaseGuildChannelV2>({
  features: undefined,
  id: `dummy-id`,
  version: FirebaseGuildChannelVersionEnum.V2,
});

The features will have random values.

channel = createHydratedMock<IFirebaseGuildChannelV2>({
  features: undefined,
  id: `dummy-id`,
  version: FirebaseGuildChannelVersionEnum.V2,
});

Expected behaviour

Same behaviour between createMock and createHydratedMock functions which replace the undefined value as expected (so createMock is better IMO).

Actual behaviour

The createHydratedMock function will ignore the given object value if undefined instead of using the value to fill the mock.

@Pmyl
Copy link
Collaborator

Pmyl commented May 21, 2021

this should be easy to solve, I'll take care of this

@Pmyl
Copy link
Collaborator

Pmyl commented May 21, 2021

PR open, just waiting for @uittorio to review it hoping he likes it 🤞

@typescripttdd
Copy link
Collaborator

🎉 This issue has been resolved in version 3.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants