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

fix: align mock of multiMerge with actual behavior #733

Merged
merged 1 commit into from Jan 11, 2022

Conversation

tido64
Copy link
Member

@tido64 tido64 commented Jan 10, 2022

Summary

Resolves #731.

Test Plan

n/a

@tido64 tido64 requested a review from krizzu January 10, 2022 21:17
asMock.__INTERNAL_MOCK_STORAGE__[key] =
oldValue != null
? JSON.stringify(merge(JSON.parse(oldValue), JSON.parse(value)))
: value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should also be stringified?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already stringified. We actually parse it in the old code:

const value = JSON.parse(keyValue[1]);

I've moved parsing until we actually need it, so we no longer need to stringify in the else-clause.

@tido64 tido64 merged commit 2dee293 into master Jan 11, 2022
@tido64 tido64 deleted the tido/fix-multiMerge-mock branch January 11, 2022 12:54
@krizzu
Copy link
Member

krizzu commented Jan 11, 2022

🎉 This PR is included in version 1.15.15 🎉

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is mergeItem mock correct for value initialisation case?
2 participants