-
-
Notifications
You must be signed in to change notification settings - Fork 951
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
test verifying altered order won't trigger config changes #1075
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1075 +/- ##
======================================
Coverage 100% 100%
======================================
Files 48 48
Lines 2256 2264 +8
Branches 109 109
======================================
+ Hits 2256 2264 +8
Continue to review full report at Codecov.
|
const newConfig = { ...userConfig, associations: { ...userConfig.associations } }; | ||
newConfig.associations.files = [...userConfig.associations.files]; | ||
newConfig.associations.files.reverse(); | ||
const initConfig = JSON.parse(JSON.stringify(newConfig)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there is no need to stringify and parse here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I just copied the line like a fool! 😂
8639a0e
to
bf9b066
Compare
newConfig.associations.files = [...userConfig.associations.files]; | ||
newConfig.associations.files.reverse(); | ||
manageApplyCustomizations(newConfig, userConfig, spy); | ||
expect(spy.called).to.not.be.true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function signature dictates oldConfig
, newConfig
, fn
. You need to revert the order of the first two parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Why do I have the feeling that
can be written as
or will it reverse also the |
Yes, it will keep the same references so you cannot do that. |
So |
You're right. |
I just remembered why I did |
I also use this for cloning huge objects. |
So the test can be written as
to keep uniformity with the others. |
I've already added it... To be honest, I favor the new syntax over the I leave it up to you if you want to include the change in #1074. |
The thing is that with stringify-parse you achieve the same result with fewer code lines which fall into my coding guidelines (we have already discussed this in another case). I think I'm gonna make the change. |
Related to #1072.
If we introduce the proposed change then order alterations will trigger change detection. That's why
intersectionWith
was being used. I've added the test so we won't miss this next time.