forked from openedx/frontend-app-authoring
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.test.ts
More file actions
44 lines (36 loc) · 1.29 KB
/
api.test.ts
File metadata and controls
44 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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);
});
});
});