* feat: Make "Pages & Resources" course apps into plugins * feat: move ora_settings * feat: move proctoring * feat: move progress * feat: move teams * feat: move wiki * feat: move Xpert settings * fix: add webpack.prod.config.js * fix: clean up unused parts of package.json files * feat: Add an error message when displaying a Course App Plugin fails * chore: fix various eslint warnings * chore: fix jest tests * fix: error preventing "npm ci" from working * feat: better tests for <SettingsComponent> * chore: move xpert_unit_summary into same dir as other plugins * fix: eslint-import-resolver-webpack is a dev dependency * chore: move learning_assistant to be a plugin too * feat: for compatibility, install 2U plugins by default * fix: bug with learning_assistant package.json
60 lines
2.0 KiB
JavaScript
60 lines
2.0 KiB
JavaScript
import React from 'react';
|
|
import { screen, waitFor } from '@testing-library/react';
|
|
|
|
import { RequestStatus } from 'CourseAuthoring/data/constants';
|
|
import { render } from 'CourseAuthoring/pages-and-resources/utils.test';
|
|
import LearningAssistantSettings from './Settings';
|
|
|
|
const onClose = () => { };
|
|
|
|
describe('Learning Assistant Settings', () => {
|
|
beforeEach(() => {
|
|
jest.clearAllMocks();
|
|
});
|
|
|
|
it('renders', async () => {
|
|
const initialState = {
|
|
models: {
|
|
courseApps: {
|
|
learning_assistant:
|
|
{
|
|
id: 'learning_assistant',
|
|
enabled: true,
|
|
name: 'Learning Assistant',
|
|
description: 'Learning Assistant description',
|
|
allowedOperations: {
|
|
configure: false,
|
|
enable: true,
|
|
},
|
|
documentationLinks: {
|
|
learnMoreOpenaiDataPrivacy: 'www.example.com/learn-more-data-privacy',
|
|
learnMoreOpenai: 'www.example.com/learn-more',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
pagesAndResources: {
|
|
loadingStatus: RequestStatus.SUCCESSFUL,
|
|
},
|
|
};
|
|
|
|
render(
|
|
<LearningAssistantSettings
|
|
onClose={onClose}
|
|
/>,
|
|
{
|
|
preloadedState: initialState,
|
|
},
|
|
);
|
|
|
|
const toggleDescription = 'Reinforce learning concepts by sharing text-based course content '
|
|
+ 'with OpenAI (via API) to power an in-course Learning Assistant. Learners can leave feedback about the quality '
|
|
+ 'of the AI-powered experience for use by edX to improve the performance of the tool.';
|
|
|
|
await waitFor(() => expect(screen.getByRole('heading', { name: 'Configure Learning Assistant' })).toBeInTheDocument());
|
|
await waitFor(() => expect(screen.getByText(toggleDescription)).toBeInTheDocument());
|
|
await waitFor(() => expect(screen.getByText('Learn more about how OpenAI handles data')).toBeInTheDocument());
|
|
await waitFor(() => expect(screen.getByText('Learn more about OpenAI API data privacy')).toBeInTheDocument());
|
|
});
|
|
});
|