Skip to content

Commit

Permalink
fix: [AXIMST-221] after review
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-romaniuk committed Jan 10, 2024
1 parent cadda87 commit 6e05e40
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/course-unit/CourseUnit.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,21 @@ describe('<CourseUnit />', () => {
const { open } = window;
window.open = jest.fn();
const { getByRole } = render(<RootWrapper />);
const { draft_preview_link, published_preview_link } = courseSectionVerticalMock;
const {
draft_preview_link: draftPreviewLink,
published_preview_link: publishedPreviewLink,
} = courseSectionVerticalMock;

await waitFor(() => {
const viewLiveButton = getByRole('button', { name: headerNavigationsMessages.viewLiveButton.defaultMessage });
userEvent.click(viewLiveButton);
expect(window.open).toHaveBeenCalled();
expect(window.open).toHaveBeenCalledWith(published_preview_link, '_blank');
expect(window.open).toHaveBeenCalledWith(publishedPreviewLink, '_blank');

const previewButton = getByRole('button', { name: headerNavigationsMessages.previewButton.defaultMessage });
userEvent.click(previewButton);
expect(window.open).toHaveBeenCalled();
expect(window.open).toHaveBeenCalledWith(draft_preview_link, '_blank');
expect(window.open).toHaveBeenCalledWith(draftPreviewLink, '_blank');
});

window.open = open;
Expand Down

0 comments on commit 6e05e40

Please sign in to comment.