Skip to content

Commit

Permalink
test: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Oct 16, 2024
1 parent f57efb4 commit 9e82795
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/course-outline/page-alerts/PageAlerts.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('<PageAlerts />', () => {
});

it('renders discussion alerts', async () => {
const { getByText, queryByText } = renderComponent({
const { findByText, queryByText } = renderComponent({
...pageAlertsData,
discussionsSettings: {
providerType: 'openedx',
Expand All @@ -104,15 +104,13 @@ describe('<PageAlerts />', () => {
expect(learnMoreBtn).toHaveAttribute('href', 'some-learn-more-url');

const dismissBtn = queryByText('Dismiss');
await act(async () => fireEvent.click(dismissBtn));
fireEvent.click(dismissBtn);
const discussionAlertDismissKey = `discussionAlertDismissed-${pageAlertsData.courseId}`;
expect(localStorage.getItem(discussionAlertDismissKey)).toBe('true');

await waitFor(() => {
const feedbackLink = getByText(messages.discussionNotificationFeedback.defaultMessage);
expect(feedbackLink);
expect(feedbackLink).toHaveAttribute('href', 'some-feedback-url');
});
const feedbackLink = await findByText(messages.discussionNotificationFeedback.defaultMessage);
expect(feedbackLink).toBeInTheDocument();
expect(feedbackLink).toHaveAttribute('href', 'some-feedback-url');
});

it('renders deprecation warning alerts', async () => {
Expand Down

0 comments on commit 9e82795

Please sign in to comment.