Skip to content

Commit fcc1445

Browse files
committed
test: Update EditorPage.test to test Advanced Editors
1 parent c80b2fd commit fcc1445

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/editors/EditorPage.test.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jest.spyOn(editorCmsApi, 'fetchByUnitId').mockImplementation(async () => ({
2626
}],
2727
},
2828
}));
29+
jest.mock('../library-authoring/LibraryBlock', () => ({
30+
LibraryBlock: jest.fn(() => (<div>Advanced Editor Iframe</div>)),
31+
}));
2932

3033
const defaultPropsHtml = {
3134
blockId: 'block-v1:Org+TS100+24+type@html+block@123456html',
@@ -79,9 +82,7 @@ describe('EditorPage', () => {
7982
expect(modalElement.classList).not.toContain('pgn__modal-xl');
8083
});
8184

82-
test('it shows an error message if there is no corresponding editor', async () => {
83-
// We can edit 'html', 'problem', and 'video' blocks.
84-
// But if we try to edit some other type, say 'fake', we should get an error:
85+
test('it shows the Advanced Editor if there is no corresponding editor', async () => {
8586
jest.spyOn(editorCmsApi, 'fetchBlockById').mockImplementationOnce(async () => ( // eslint-disable-next-line
8687
{ status: 200, data: { display_name: 'Fake Un-editable Block', category: 'fake', metadata: {}, data: '' } }
8788
));
@@ -93,6 +94,6 @@ describe('EditorPage', () => {
9394
};
9495
render(<EditorPage {...defaultPropsFake} />);
9596

96-
expect(await screen.findByText('Error: Could Not find Editor')).toBeInTheDocument();
97+
expect(await screen.findByText('Advanced Editor Iframe')).toBeInTheDocument();
9798
});
9899
});

0 commit comments

Comments
 (0)