wp-graphql-content-blocks icon indicating copy to clipboard operation
wp-graphql-content-blocks copied to clipboard

tests: backfill tests for `ContentBlockResolver`

Open Ta5r opened this issue 5 months ago • 2 comments

What

This PR backfills additional test cases for the ContentBlocksResolver class in ContentBlocksResolverTest.

How

The following test cases are included:

  • Pre-resolve Filter Test: test_pre_resolved_blocks_filter_returns_non_null ensures that the wpgraphql_content_blocks_pre_resolve_blocks filter correctly modifies the block content before the blocks are resolved.
  • Empty Content Test: 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.
  • Post-resolve Filter Test: test_filters_wpgraphql_content_blocks_resolve_blocks ensures that the wpgraphql_content_blocks_resolve_blocks filter correctly modifies block content after the blocks are resolved.
  • Inner Block Test: test_inner_blocks tests resolution for both flat and nested blocks, including the correct parentClientIds are set, and that there are no discrepancies between flat/nested resolution.

Ta5r avatar Sep 23 '24 09:09 Ta5r