Skip to content

Commit 8fe30f4

Browse files
committed
test: fix failing tests
1 parent 30e3655 commit 8fe30f4

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/course-unit/add-component/AddComponent.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jest.mock('../../library-authoring/component-picker', () => ({
5252
}));
5353

5454
const mockSendMessageToIframe = jest.fn();
55-
jest.mock('../context/hooks', () => ({
55+
jest.mock('../../generic/hooks/context/hooks', () => ({
5656
useIframe: () => ({
5757
sendMessageToIframe: mockSendMessageToIframe,
5858
}),

src/course-unit/preview-changes/index.test.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010

1111
import IframePreviewLibraryXBlockChanges, { LibraryChangesMessageData } from '.';
1212
import { messageTypes } from '../constants';
13-
import { IframeProvider } from '../../generic/hooks/context/iFrameContext';
1413
import { libraryBlockChangesUrl } from '../data/api';
1514
import { ToastActionData } from '../../generic/toast-context';
1615
import { getLibraryBlockMetadataUrl } from '../../library-authoring/data/api';
@@ -25,15 +24,15 @@ const defaultEventData: LibraryChangesMessageData = {
2524
};
2625

2726
const mockSendMessageToIframe = jest.fn();
28-
jest.mock('../context/hooks', () => ({
27+
jest.mock('../../generic/hooks/context/hooks', () => ({
2928
useIframe: () => ({
29+
iframeRef: { current: { contentWindow: {} as HTMLIFrameElement } },
30+
setIframeRef: () => {},
3031
sendMessageToIframe: mockSendMessageToIframe,
3132
}),
3233
}));
3334
const render = (eventData?: LibraryChangesMessageData) => {
34-
baseRender(<IframePreviewLibraryXBlockChanges />, {
35-
extraWrapper: ({ children }) => <IframeProvider>{ children }</IframeProvider>,
36-
});
35+
baseRender(<IframePreviewLibraryXBlockChanges />);
3736
const message = {
3837
data: {
3938
type: messageTypes.showXBlockLibraryChangesPreview,

src/library-authoring/data/apiHooks.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,12 @@ describe('library api hooks', () => {
141141
});
142142

143143
it('should get container metadata', async () => {
144+
const libraryId = 'lib:org:1';
144145
const containerId = 'lct:lib:org:unit:unit1';
145146
const url = getLibraryContainerApiUrl(containerId);
146147

147148
axiosMock.onGet(url).reply(200, { 'test-data': 'test-value' });
148-
const { result } = renderHook(() => useContainer(containerId), { wrapper });
149+
const { result } = renderHook(() => useContainer(libraryId, containerId), { wrapper });
149150
await waitFor(() => {
150151
expect(result.current.isLoading).toBeFalsy();
151152
});

0 commit comments

Comments
 (0)