test: cms urls (#23)
This commit is contained in:
37
src/editors/data/services/cms/urls.test.js
Normal file
37
src/editors/data/services/cms/urls.test.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
unit,
|
||||
block,
|
||||
blockAncestor,
|
||||
} from './urls';
|
||||
|
||||
describe('cms url methods', () => {
|
||||
const studioEndpointUrl = 'urLgoeStOstudiO';
|
||||
const blockId = 'blOckIDTeST123';
|
||||
describe('unit', () => {
|
||||
const unitUrl = {
|
||||
data: {
|
||||
ancestors: [
|
||||
{
|
||||
id: 'unItUrlTEST',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
it('returns url with studioEndpointUrl and unitUrl', () => {
|
||||
expect(unit({ studioEndpointUrl, unitUrl }))
|
||||
.toEqual(`${studioEndpointUrl}/container/${unitUrl.data.ancestors[0].id}`);
|
||||
});
|
||||
});
|
||||
describe('block', () => {
|
||||
it('returns url with studioEndpointUrl and blockId', () => {
|
||||
expect(block({ studioEndpointUrl, blockId }))
|
||||
.toEqual(`${studioEndpointUrl}/xblock/${blockId}`);
|
||||
});
|
||||
});
|
||||
describe('blockAncestor', () => {
|
||||
it('returns url with studioEndpointUrl, blockId and ancestor query', () => {
|
||||
expect(blockAncestor({ studioEndpointUrl, blockId }))
|
||||
.toEqual(`${block({ studioEndpointUrl, blockId })}?fields=ancestorInfo`);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user