From be0746354b21c38ea894c74357dbd713e19a0a80 Mon Sep 17 00:00:00 2001 From: XnpioChV Date: Thu, 26 Sep 2024 18:39:24 -0500 Subject: [PATCH] test: tags_count in ComponentManagement --- .../component-info/ComponentManagement.test.tsx | 13 +++++++++++++ src/library-authoring/data/api.mocks.ts | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/library-authoring/component-info/ComponentManagement.test.tsx b/src/library-authoring/component-info/ComponentManagement.test.tsx index d30b6b47d2..89656544ee 100644 --- a/src/library-authoring/component-info/ComponentManagement.test.tsx +++ b/src/library-authoring/component-info/ComponentManagement.test.tsx @@ -7,6 +7,7 @@ import { } from '../../testUtils'; import { mockLibraryBlockMetadata } from '../data/api.mocks'; import ComponentManagement from './ComponentManagement'; +import { mockContentTaxonomyTagsData } from '../../content-tags-drawer/data/api.mocks'; jest.mock('../../content-tags-drawer', () => ({ ContentTagsDrawer: () =>
Mocked ContentTagsDrawer
, @@ -70,4 +71,16 @@ describe('', () => { expect(await screen.findByText('Draft')).toBeInTheDocument(); expect(screen.queryByText('Tags')).not.toBeInTheDocument(); }); + + it('should render tag count in tagging info', async () => { + setConfig({ + ...getConfig(), + ENABLE_TAGGING_TAXONOMY_PAGES: 'true', + }); + initializeMocks(); + mockLibraryBlockMetadata.applyMock(); + mockContentTaxonomyTagsData.applyMock(); + render(); + expect(await screen.findByText('Tags (6)')).toBeInTheDocument(); + }); }); diff --git a/src/library-authoring/data/api.mocks.ts b/src/library-authoring/data/api.mocks.ts index 0002f7516a..3b52739532 100644 --- a/src/library-authoring/data/api.mocks.ts +++ b/src/library-authoring/data/api.mocks.ts @@ -1,4 +1,5 @@ /* istanbul ignore file */ +import { mockContentTaxonomyTagsData } from '../../content-tags-drawer/data/api.mocks'; import { createAxiosError } from '../../testUtils'; import * as api from './api'; @@ -219,6 +220,7 @@ export async function mockLibraryBlockMetadata(usageKey: string): Promise jest.spyOn(api, 'getLibraryBlockMetadata').mockImplementation(mockLibraryBlockMetadata);