Skip to content

Commit 8d84f68

Browse files
test: fix completely broken tests
1 parent d6e348e commit 8d84f68

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/generic/create-or-rerun-course/CreateOrRerunCourseForm.test.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import {
32
fireEvent,
43
screen,
@@ -212,7 +211,7 @@ describe('<CreateOrRerunCourseForm />', () => {
212211
fireEvent.change(numberInput, { target: { value: 'long-name-which-is-longer-than-65-characters-to-check-for-errors' } });
213212

214213
await waitFor(() => {
215-
expect(screen.getByText(messages.totalLengthError)).toBeInTheDocument();
214+
expect(screen.getByText(messages.totalLengthError.defaultMessage)).toBeInTheDocument();
216215
});
217216
});
218217

@@ -278,9 +277,10 @@ describe('<CreateOrRerunCourseForm />', () => {
278277
const numberInput = await screen.findByPlaceholderText(messages.courseNumberPlaceholder.defaultMessage);
279278

280279
fireEvent.change(numberInput, { target: { value: 'number with invalid (+) symbol' } });
280+
fireEvent.blur(numberInput);
281281

282282
await waitFor(() => {
283-
expect(screen.getByText(messages.noSpaceError)).toBeInTheDocument();
283+
expect(screen.getByText(messages.disallowedCharsError.defaultMessage)).toBeInTheDocument();
284284
});
285285
});
286286
});
File renamed without changes.

src/pages-and-resources/discussions/data/redux.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,10 @@ describe('Data layer integration tests', () => {
326326
test('successfully saves an LTI configuration', async () => {
327327
axiosMock.onGet(getDiscussionsProvidersUrl(courseId)).reply(200, generateProvidersApiResponse());
328328
axiosMock.onGet(getDiscussionsSettingsUrl(courseId)).reply(200, piazzaApiResponse);
329+
// Note: if this test is failing, it's likely because the POSTed data has changed and no longer exactly matches
330+
// the expected data in the mock below.
329331
axiosMock.onPost(getDiscussionsSettingsUrl(courseId), {
330332
context_key: courseId,
331-
enabled: true,
332333
lti_configuration: {
333334
lti_1p1_client_key: 'new_consumer_key',
334335
lti_1p1_client_secret: 'new_consumer_secret',
@@ -388,9 +389,10 @@ describe('Data layer integration tests', () => {
388389
test('successfully saves a Legacy configuration', async () => {
389390
axiosMock.onGet(getDiscussionsProvidersUrl(courseId)).reply(200, generateProvidersApiResponse(false, 'legacy'));
390391
axiosMock.onGet(getDiscussionsSettingsUrl(courseId)).reply(200, legacyApiResponse);
392+
// Note: if this test is failing, it's likely because the POSTed data has changed and no longer exactly matches
393+
// the expected data in the mock below.
391394
axiosMock.onPost(getDiscussionsSettingsUrl(courseId), {
392395
context_key: courseId,
393-
enabled: true,
394396
lti_configuration: {},
395397
plugin_configuration: {
396398
allow_anonymous: true,

0 commit comments

Comments
 (0)