Comment Template Block: Add test coverage for context setting#50879
Comment Template Block: Add test coverage for context setting#50879
Conversation
|
Flaky tests detected in e4c1ff7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5058441320
|
d09ba37 to
4ab65a5
Compare
|
gziolo
left a comment
There was a problem hiding this comment.
Thank you for adding this test covering special case for the Comment Template block. It was very helpful to see the PR targeting WordPress Core to confrim that setup code is only duplicated to run it in the Gutenberg repo.
Have you considered adding an additional assertion to verify whether the $comment_author_name_block variable is non-empty string or has some shape at all. It would cover the case when the block would stop rendering any output, but it might be covered with other tests. So it isn't a blocker, but something for you to decide.
Ah yeah, sounds like a great idea! I'll add something. |
…ess#50879) Add a unit test to verify that the Comment Template block sets `commentId` context as expected.
What?
Add a unit test to verify that the Comment Template block sets
commentIdcontext as expected. Follow up to #50279; see #50279 (comment) for context.Why?
Conversation on #50279 indicates that it's fairly easy to make a change to the relevant code which would break this behavior. Consequently, it makes sense to guard against such breakage.
How?
By inserting a block which requires
commentIdcontext to work via therender_blockhook.Testing Instructions
npm run test:unit:php -- --group=blocks.npm run build). Re-run the test, and verify that it fails now.Note
In the long run, this test should be merged into
wordpress-develop'srenderCommentTemplate.phptest file.