forked from openedx/frontend-app-communications
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend-platform supports runtime configuration since 2.5.0 (see the PR that introduced it[1], but it requires MFE cooperation. This implements just that: by avoiding making configuration values constant, it should now be possible to change them after initialization. Only a single change related to the `LMS_BASE_URL` setting was required. [1] openedx/frontend-platform#335
- Loading branch information
Showing
2 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Factory } from 'rosie'; // eslint-disable-line import/no-extraneous-dependencies | ||
import { camelCaseObject } from '@edx/frontend-platform'; | ||
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; | ||
import MockAdapter from 'axios-mock-adapter'; | ||
import { initializeMockApp } from '../../../setupTest'; | ||
import * as api from './api'; | ||
import './__factories__/courseMetadata.factory'; | ||
|
||
describe('api', () => { | ||
beforeAll(async () => { | ||
await initializeMockApp(); | ||
}); | ||
|
||
test('getCourseHomeCourseMetadata', async () => { | ||
const axiosMock = new MockAdapter(getAuthenticatedHttpClient()); | ||
const courseMetadata = Factory.build('courseMetadata'); | ||
const { id: courseId } = courseMetadata; | ||
axiosMock | ||
.onGet(`${api.getCourseHomeBaseUrl()}/${courseId}`) | ||
.reply(200, courseMetadata); | ||
const data = await api.getCourseHomeCourseMetadata(courseId); | ||
expect(data).toEqual(camelCaseObject(courseMetadata)); | ||
}); | ||
}); |