Skip to content

Commit 8dae5ff

Browse files
Refactor CdpPageView tests to update event imports from browser-specific module to unified events module (#441)
1 parent 4016fc7 commit 8dae5ff

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

examples/kit-nextjs-location-finder/src/_tests_/components/content-sdk/CdpPageView.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jest.mock('@sitecore-content-sdk/nextjs', () => ({
1515
}));
1616

1717
// Mock the Sitecore Cloud SDK
18-
jest.mock('@sitecore-cloudsdk/events/browser', () => ({
18+
jest.mock('@sitecore-content-sdk/events', () => ({
1919
pageView: jest.fn(),
2020
}));
2121

@@ -30,7 +30,7 @@ jest.mock('sitecore.config', () => ({
3030
}));
3131

3232
import { useSitecore } from '@sitecore-content-sdk/nextjs';
33-
import { pageView } from '@sitecore-cloudsdk/events/browser';
33+
import { pageView } from '@sitecore-content-sdk/events';
3434

3535
const mockedUseSitecore = useSitecore as jest.MockedFunction<typeof useSitecore>;
3636
const mockPageView = pageView as jest.MockedFunction<typeof pageView>;
@@ -39,6 +39,8 @@ type MockSitecoreContext = ReturnType<typeof useSitecore>;
3939

4040
describe('CdpPageView Component', () => {
4141
const mockSitecoreContext: MockSitecoreContext = {
42+
loadImportMap: jest.fn(),
43+
componentMap: new Map(),
4244
page: {
4345
layout: {
4446
sitecore: {

examples/kit-nextjs-product-listing/src/__tests__/content-sdk/CdpPageView.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jest.mock('@sitecore-content-sdk/nextjs', () => ({
1818

1919
// Mock pageView from Content SDK events
2020
const mockPageView = jest.fn().mockReturnValue(Promise.resolve());
21-
jest.mock('@sitecore-content-sdk/events/browser', () => ({
21+
jest.mock('@sitecore-content-sdk/events', () => ({
2222
pageView: (config: unknown) => mockPageView(config),
2323
}));
2424

0 commit comments

Comments
 (0)