Skip to content

Commit

Permalink
test: solve some issues with some failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-i-am committed Aug 5, 2024
1 parent dfb1e4e commit 28e914a
Show file tree
Hide file tree
Showing 28 changed files with 632 additions and 829 deletions.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ module.exports = createConfig('jest', {
modulePathIgnorePatterns: [
'/src/pages-and-resources/utils.test.jsx',
],
testTimeout: 30000,
});
296 changes: 120 additions & 176 deletions plugins/course-apps/proctoring/Settings.test.jsx

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/certificates/layout/header-buttons/HeaderButtons.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ describe('HeaderButtons Component', () => {
expect(previewLink).toHaveAttribute('href', expect.stringContaining(certificatesDataMock.courseModes[0]));

const dropdownButton = getByRole('button', { name: certificatesDataMock.courseModes[0] });
await userEvent.click(dropdownButton);
userEvent.click(dropdownButton);

const verifiedMode = await getByRole('button', { name: certificatesDataMock.courseModes[1] });
await userEvent.click(verifiedMode);
userEvent.click(verifiedMode);

await waitFor(() => {
expect(previewLink).toHaveAttribute('href', expect.stringContaining(certificatesDataMock.courseModes[1]));
Expand All @@ -78,7 +78,7 @@ describe('HeaderButtons Component', () => {
const { getByRole, queryByRole } = renderComponent();

const activationButton = getByRole('button', { name: messages.headingActionsActivate.defaultMessage });
await userEvent.click(activationButton);
userEvent.click(activationButton);

axiosMock.onPost(
getUpdateCertificateApiUrl(courseId, certificatesDataMock.certificates[0].id),
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('HeaderButtons Component', () => {
const { getByRole, queryByRole } = renderComponent();

const deactivateButton = getByRole('button', { name: messages.headingActionsDeactivate.defaultMessage });
await userEvent.click(deactivateButton);
userEvent.click(deactivateButton);

axiosMock.onPost(
getUpdateCertificateApiUrl(courseId, certificatesDataMock.certificates[0].id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ const ChecklistItemComment = ({
<ul className="assignment-list">
{gradedAssignmentsOutsideDateRange.map(assignment => (
<li className="assignment-list-item" key={assignment.id}>
<Hyperlink
content={assignment.displayName}
destination={`${outlineUrl}#${assignment.id}`}
/>
<Hyperlink destination={`${outlineUrl}#${assignment.id}`}>
{assignment.displayName}
</Hyperlink>
</li>
))}
</ul>
Expand Down
12 changes: 6 additions & 6 deletions src/course-rerun/CourseRerun.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ describe('<CourseRerun />', () => {
useSelector.mockReturnValue({ organizationLoadingStatus: RequestStatus.IN_PROGRESS });

await act(async () => {
const { getByRole } = render(<RootWrapper />);
const spinner = getByRole('status');
const { findByRole } = render(<RootWrapper />);
const spinner = await findByRole('status');
expect(spinner.textContent).toEqual('Loading...');
});
});

it('should show footer', () => {
const { getByText } = render(<RootWrapper />);
expect(getByText('Looking for help with Studio?')).toBeInTheDocument();
expect(getByText('LMS')).toHaveAttribute('href', process.env.LMS_BASE_URL);
it('should show footer', async () => {
const { findByText } = render(<RootWrapper />);
expect(await findByText('Looking for help with Studio?')).toBeInTheDocument();
expect(await findByText('LMS')).toHaveAttribute('href', process.env.LMS_BASE_URL);
});
});
Loading

0 comments on commit 28e914a

Please sign in to comment.