Skip to content

Commit 3ad5c50

Browse files
authored
Fix withBlockBinding tests by mocking tracks (#209)
Pull request #185 has caused an issue with the withBlockBinding tests, which attempt to use the Tracks API. To resolve this, the Tracks function was mocked.
1 parent 91d7e1c commit 3ad5c50

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/src/blocks/remote-data-container/filters/withBlockBinding.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@ import { REMOTE_DATA_CONTEXT_KEY } from '@/blocks/remote-data-container/config/c
55
import { withBlockBinding } from '@/blocks/remote-data-container/filters/withBlockBinding';
66
import { BLOCK_BINDING_SOURCE, PATTERN_OVERRIDES_CONTEXT_KEY } from '@/config/constants';
77

8+
vi.mock( '@/blocks/remote-data-container/utils/tracks', () => ( {
9+
sendTracksEvent: vi.fn(),
10+
} ) );
11+
812
// Minimal mocking for WordPress dependencies
913
vi.mock( '@wordpress/block-editor', () => ( {
1014
InspectorControls: ( { children }: { children: React.ReactNode } ) => (
1115
<div data-testid="inspector-controls">{ children }</div>
1216
),
1317
} ) );
18+
1419
vi.mock( '@wordpress/components', () => ( {
1520
PanelBody: ( { children, title }: { children: React.ReactNode; title: string } ) => (
1621
<div data-testid="panel-body" title={ title }>
1722
{ children }
1823
</div>
1924
),
2025
} ) );
26+
2127
vi.mock( '@/hooks/useEditedPostAttribute', () => ( {
2228
useEditedPostAttribute: () => ( {
2329
postType: '',

0 commit comments

Comments
 (0)