- Use the new preview migration API implemented in https://github.com/openedx/edx-platform/pull/37818 - Clean the code for the preview. - Implements the commented in https://github.com/openedx/frontend-app-authoring/issues/2525#issuecomment-3554310315
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { initializeMocks } from '../testUtils';
|
|
import * as api from './api';
|
|
|
|
let axiosMock;
|
|
|
|
describe('legacy libraries migration API', () => {
|
|
beforeEach(() => {
|
|
({ axiosMock } = initializeMocks());
|
|
});
|
|
|
|
describe('getModulestoreMigrationStatus', () => {
|
|
it('should get migration status', async () => {
|
|
const migrationId = '1';
|
|
const url = api.getModulestoreMigrationStatusUrl(migrationId);
|
|
axiosMock.onGet(url).reply(200);
|
|
await api.getModulestoreMigrationStatus(migrationId);
|
|
|
|
expect(axiosMock.history.get[0].url).toEqual(url);
|
|
});
|
|
});
|
|
|
|
describe('bulkMigrateLegacyLibraries', () => {
|
|
it('should call bulk migrate legacy libraries', async () => {
|
|
const url = api.bulkModulestoreMigrateUrl();
|
|
axiosMock.onPost(url).reply(200);
|
|
await api.bulkModulestoreMigrate({
|
|
sources: [],
|
|
target: '1',
|
|
});
|
|
|
|
expect(axiosMock.history.post[0].url).toEqual(url);
|
|
});
|
|
});
|
|
|
|
describe('getPreviewModulestoreMigration', () => {
|
|
it('should call get preview modulestore migration', async () => {
|
|
const url = api.getPreviewModulestoreMigrationUrl();
|
|
axiosMock.onGet(url).reply(200);
|
|
await api.getPreviewModulestoreMigration('1', '2');
|
|
|
|
expect(axiosMock.history.get[0].url).toEqual(url);
|
|
});
|
|
});
|
|
});
|