fix: content-manager test

This commit is contained in:
Josh 2024-03-21 13:15:31 +00:00
parent a233ba0144
commit 40b339395f
3 changed files with 12 additions and 3 deletions

View File

@ -14,16 +14,16 @@ import {
Typography,
} from '@strapi/design-system';
import { Check, ExclamationMarkCircle, Trash } from '@strapi/icons';
import { Contracts } from '@strapi/plugin-content-manager/_internal/shared';
import { AxiosError, AxiosResponse } from 'axios';
import { useIntl } from 'react-intl';
import { useQueryClient } from 'react-query';
import { useParams } from 'react-router-dom';
import { NotificationConfig, useNotification, useTracking } from '../../../../..';
import { DescriptionComponentRenderer } from '../../../../../components/DescriptionComponentRenderer';
import { useTypedSelector } from '../../../../../core/store/hooks';
import { NotificationConfig, useNotification } from '../../../../../features/Notifications';
import { useStrapiApp } from '../../../../../features/StrapiApp';
import { useTracking } from '../../../../../features/Tracking';
import { useDoc } from '../../../../hooks/useDocument';
import { getTranslation } from '../../../../utils/translations';
// import { useAllowedActions } from '../../hooks/useAllowedActions';
@ -34,6 +34,7 @@ import type {
BulkActionComponent,
ContentManagerPlugin,
} from '../../../../../core/apis/content-manager';
import type { Contracts } from '@strapi/plugin-content-manager/_internal/shared';
interface BulkActionDescription {
dialog?: DialogOptions | NotificationOptions | ModalOptions;

View File

@ -186,7 +186,7 @@ class ContentManagerPlugin {
this.headerActions = actions(this.headerActions);
} else {
throw new Error(
`Expected the \`actions\` passed to \`addBulkAction\` to be an array or a function, but received ${getPrintableType(
`Expected the \`actions\` passed to \`addDocumentHeaderAction\` to be an array or a function, but received ${getPrintableType(
actions
)}`
);

View File

@ -35,6 +35,10 @@ jest.mock('../../../content-manager/pages/ListView/components/TableActions', ()
DEFAULT_TABLE_ROW_ACTIONS: [],
}));
jest.mock('../../../content-manager/pages/ListView/components/BulkActions/Actions', () => ({
DEFAULT_BULK_ACTIONS: [],
}));
describe('content-manager', () => {
describe('config', () => {
it("should export the a config shape to pretend it's a plugin", () => {
@ -43,9 +47,11 @@ describe('content-manager', () => {
expect(plugin.config).toMatchInlineSnapshot(`
{
"apis": {
"addBulkAction": [Function],
"addDocumentAction": [Function],
"addDocumentHeaderAction": [Function],
"addEditViewSidePanel": [Function],
"getBulkActions": [Function],
"getDocumentActions": [Function],
"getEditViewSidePanels": [Function],
"getHeaderActions": [Function],
@ -71,6 +77,8 @@ describe('content-manager', () => {
"getDocumentActions",
"getHeaderActions",
"getEditViewSidePanels",
"addBulkAction",
"getBulkActions",
]
`);
});