-
Notifications
You must be signed in to change notification settings - Fork 0
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
tests: backfill tests for ContentBlockResolver
#12
Conversation
f0860a6
to
31944d8
Compare
ad75095
to
09f83cc
Compare
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.
@Ta5r -
I rebased this PR on the latest dev/refactor-ContentBlocksResolver
, so remember to git pul --force
before committing any new changes.
ContentBlockResolver
(post-refactor)
844138a
to
fcde1f2
Compare
ContentBlockResolver
(post-refactor)ContentBlockResolver
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.
@Ta5r Take a look at c5f0410 where:
- I removed tests that were already being covered (per the previous comments)
- I refactored the inner blocks test so it's more clear what exactly it is asserting (general rule: avoid transforming results, instead create an
::assert*()
that holds the relevant transformation logic.
Also cleaned up the PR description (they have CI so no need for a screenshot, and removed the jargon so it's more clearly indicates what's included).
Go ahead and generate a changeset, and open up a PR upstream.
Tracking: wpengine#292 (comment)
What
This PR backfills additional test cases for the
ContentBlocksResolver
class inContentBlocksResolverTest
.How
The following test cases are included:
test_pre_resolved_blocks_filter_returns_non_null
ensures that thewpgraphql_content_blocks_pre_resolve_blocks
filter correctly modifies the block content before the blocks are resolved.test_returns_empty_array_for_empty_content
checks that an empty array is returned when the post content is empty, ensuring proper behavior for posts with no blocks.test_filters_wpgraphql_content_blocks_resolve_blocks
ensures that thewpgraphql_content_blocks_resolve_blocks
filter correctly modifies block content after the blocks are resolved.test_inner_blocks
tests resolution for both flat and nested blocks, including the correctparentClientIds
are set, and that there are no discrepancies between flat/nested resolution.