Skip to content

Commit 5e48e3d

Browse files
committed
Fixes failing tests
1 parent 02b5952 commit 5e48e3d

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/__tests__/SearchOrBrowseWindow.spec.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import SearchOrBrowseWindow from '../SearchOrBrowseWindow';
55
import { RouteNames } from '../../../constants';
66
import { sendRequest } from 'shared/feedbackApiUtils';
77

8+
// Mock the jsonSchema compile function to always return true
9+
jest.mock('shared/utils/jsonSchema', () => ({
10+
compile: () => () => true,
11+
}));
12+
813
// Mock dependencies
914
jest.mock('shared/feedbackApiUtils', () => ({
1015
RecommendationsEvent: jest.fn().mockImplementation(() => ({
@@ -35,14 +40,6 @@ describe('SearchOrBrowseWindow', () => {
3540
actions = {
3641
showSnackbar: jest.fn(),
3742
'clipboard/copy': jest.fn().mockResolvedValue(),
38-
'contentNode/loadAncestors': jest.fn().mockResolvedValue([
39-
{
40-
id: 'parent-id',
41-
title: 'Parent',
42-
description: 'Parent desc',
43-
channel_id: 'channel-id',
44-
},
45-
]),
4643
'contentNode/loadPublicContentNode': jest.fn().mockImplementation(({ id }) =>
4744
Promise.resolve({
4845
id,
@@ -81,7 +78,7 @@ describe('SearchOrBrowseWindow', () => {
8178
'currentChannel/currentChannel': () => ({ language: 'en' }),
8279
'importFromChannels/savedSearchesExist': () => true,
8380
isAIFeatureEnabled: () => true,
84-
'contentNode/getContentNode': () => ({ id: 'node-1' }),
81+
'contentNode/getContentNodeAncestors': () => () => [{ id: 'node-1' }],
8582
};
8683

8784
store = new Store({
@@ -107,11 +104,10 @@ describe('SearchOrBrowseWindow', () => {
107104
contentNode: {
108105
namespaced: true,
109106
actions: {
110-
loadAncestors: actions['contentNode/loadAncestors'],
111107
loadPublicContentNode: actions['contentNode/loadPublicContentNode'],
112108
},
113109
getters: {
114-
getContentNode: getters['contentNode/getContentNode'],
110+
getContentNodeAncestors: getters['contentNode/getContentNodeAncestors'],
115111
},
116112
},
117113
currentChannel: {
@@ -182,9 +178,6 @@ describe('SearchOrBrowseWindow', () => {
182178

183179
it('initializes correctly', () => {
184180
expect(wrapper.vm.searchTerm).toBe('');
185-
expect(actions['contentNode/loadAncestors']).toHaveBeenCalledWith(expect.anything(), {
186-
id: 'dest-1',
187-
});
188181
});
189182

190183
it('validates search term correctly', async () => {

0 commit comments

Comments
 (0)