feat: manage collections in component sidebar [FC-0062] (#1373)
* feat: add to collection in sidebar * feat: manage collections * test: add tests for manage collections * feat: remove from collection menu option
This commit is contained in:
@@ -95,6 +95,7 @@ mockCreateLibraryBlock.newHtmlData = {
|
||||
created: '2024-07-22T21:37:49Z',
|
||||
modified: '2024-07-22T21:37:49Z',
|
||||
tagsCount: 0,
|
||||
collections: [],
|
||||
} satisfies api.LibraryBlockMetadata;
|
||||
mockCreateLibraryBlock.newProblemData = {
|
||||
id: 'lb:Axim:TEST:problem:prob1',
|
||||
@@ -109,6 +110,7 @@ mockCreateLibraryBlock.newProblemData = {
|
||||
created: '2024-07-22T21:37:49Z',
|
||||
modified: '2024-07-22T21:37:49Z',
|
||||
tagsCount: 0,
|
||||
collections: [],
|
||||
} satisfies api.LibraryBlockMetadata;
|
||||
mockCreateLibraryBlock.newVideoData = {
|
||||
id: 'lb:Axim:TEST:video:vid1',
|
||||
@@ -123,6 +125,7 @@ mockCreateLibraryBlock.newVideoData = {
|
||||
created: '2024-07-22T21:37:49Z',
|
||||
modified: '2024-07-22T21:37:49Z',
|
||||
tagsCount: 0,
|
||||
collections: [],
|
||||
} satisfies api.LibraryBlockMetadata;
|
||||
/** Apply this mock. Returns a spy object that can tell you if it's been called. */
|
||||
mockCreateLibraryBlock.applyMock = () => (
|
||||
@@ -200,6 +203,7 @@ export async function mockLibraryBlockMetadata(usageKey: string): Promise<api.Li
|
||||
throw createAxiosError({ code: 404, message: 'Not found.', path: api.getLibraryBlockMetadataUrl(usageKey) });
|
||||
case thisMock.usageKeyNeverPublished: return thisMock.dataNeverPublished;
|
||||
case thisMock.usageKeyPublished: return thisMock.dataPublished;
|
||||
case thisMock.usageKeyWithCollections: return thisMock.dataWithCollections;
|
||||
case thisMock.usageKeyThirdPartyXBlock: return thisMock.dataThirdPartyXBlock;
|
||||
case thisMock.usageKeyForTags: return thisMock.dataPublished;
|
||||
default: throw new Error(`No mock has been set up for usageKey "${usageKey}"`);
|
||||
@@ -221,6 +225,7 @@ mockLibraryBlockMetadata.dataNeverPublished = {
|
||||
created: '2024-06-20T13:54:21Z',
|
||||
modified: '2024-06-21T13:54:21Z',
|
||||
tagsCount: 0,
|
||||
collections: [],
|
||||
} satisfies api.LibraryBlockMetadata;
|
||||
mockLibraryBlockMetadata.usageKeyPublished = 'lb:Axim:TEST2:html:571fe018-f3ce-45c9-8f53-5dafcb422fd2';
|
||||
mockLibraryBlockMetadata.dataPublished = {
|
||||
@@ -236,6 +241,7 @@ mockLibraryBlockMetadata.dataPublished = {
|
||||
created: '2024-06-20T13:54:21Z',
|
||||
modified: '2024-06-21T13:54:21Z',
|
||||
tagsCount: 0,
|
||||
collections: [],
|
||||
} satisfies api.LibraryBlockMetadata;
|
||||
mockLibraryBlockMetadata.usageKeyThirdPartyXBlock = mockXBlockFields.usageKeyThirdParty;
|
||||
mockLibraryBlockMetadata.dataThirdPartyXBlock = {
|
||||
@@ -244,6 +250,22 @@ mockLibraryBlockMetadata.dataThirdPartyXBlock = {
|
||||
blockType: 'third_party',
|
||||
} satisfies api.LibraryBlockMetadata;
|
||||
mockLibraryBlockMetadata.usageKeyForTags = mockContentTaxonomyTagsData.largeTagsId;
|
||||
mockLibraryBlockMetadata.usageKeyWithCollections = 'lb:Axim:TEST:html:571fe018-f3ce-45c9-8f53-5dafcb422fdd';
|
||||
mockLibraryBlockMetadata.dataWithCollections = {
|
||||
id: 'lb:Axim:TEST:html:571fe018-f3ce-45c9-8f53-5dafcb422fdd',
|
||||
defKey: null,
|
||||
blockType: 'html',
|
||||
displayName: 'Introduction to Testing 2',
|
||||
lastPublished: '2024-06-21T00:00:00',
|
||||
publishedBy: 'Luke',
|
||||
lastDraftCreated: null,
|
||||
lastDraftCreatedBy: '2024-06-20T20:00:00Z',
|
||||
hasUnpublishedChanges: false,
|
||||
created: '2024-06-20T13:54:21Z',
|
||||
modified: '2024-06-21T13:54:21Z',
|
||||
tagsCount: 0,
|
||||
collections: [{ title: 'My first collection', key: 'my-first-collection' }],
|
||||
} satisfies api.LibraryBlockMetadata;
|
||||
/** Apply this mock. Returns a spy object that can tell you if it's been called. */
|
||||
mockLibraryBlockMetadata.applyMock = () => jest.spyOn(api, 'getLibraryBlockMetadata').mockImplementation(mockLibraryBlockMetadata);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user