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

View File

@ -186,7 +186,7 @@ class ContentManagerPlugin {
this.headerActions = actions(this.headerActions); this.headerActions = actions(this.headerActions);
} else { } else {
throw new Error( 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 actions
)}` )}`
); );

View File

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