Skip to content

Fix: reducer tested properties not related to replaceInnerBlocks action while testing that action #15002

Closed
jorgefilipecosta wants to merge 1 commit into
masterfrom
fix/replaceInnerBlocksUnitTests
Closed

Fix: reducer tested properties not related to replaceInnerBlocks action while testing that action #15002
jorgefilipecosta wants to merge 1 commit into
masterfrom
fix/replaceInnerBlocksUnitTests

Conversation

@jorgefilipecosta
Copy link
Copy Markdown
Member

Initially, during #14291, I noticed that in the reducer that tests for the replaceInnerBlocks action there has a property that was not relevant to this tests and so I did not check it ( used isPersistentChange: expect.anything())
Meanwhile, in #14916 the expect anything was removed and the tests were updated to take into account a new property.

I think these tests should use toMatchObject to make sure new properties added in the future not related to the action we are testing don't have an impact on the tests.

cc: @aduth

How has this been tested?

I verified the unit tests pass.

@jorgefilipecosta jorgefilipecosta added [Type] Enhancement A suggestion for improvement. [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. labels Apr 16, 2019
Copy link
Copy Markdown
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Personally, I'd rather the verbosity than run the risk that there's some strange edge case where a wildly-unexpected value is assigned for one of these properties, or somehow additional unexpected properties become included in state. In other words, I don't think they should be considered as "not related to the action" because all of the state is always relevant to any action the reducer manages.

@jorgefilipecosta
Copy link
Copy Markdown
Member Author

Personally, I'd rather the verbosity than run the risk that there's some strange edge case where a wildly-unexpected value is assigned for one of these properties, or somehow additional unexpected properties become included in state. In other words, I don't think they should be considered as "not related to the action" because all of the state is always relevant to any action the reducer manages.

Hi @aduth thank you for sharing your thoughts. In that case, I will close the PR, and follow the same line of thought in future similar situations.

@jorgefilipecosta jorgefilipecosta deleted the fix/replaceInnerBlocksUnitTests branch April 29, 2019 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants