mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
fix(content-releases): fix flaky FE unit tests (#19927)
* fix(content-releases): fix flaky unit tests * fix(content-releases): change Permission mock * fix(content-releases): change CheckPermissions mock for all the CR unit tests
This commit is contained in:
parent
3c5ba453a2
commit
a4bd82ce45
@ -1,3 +1,5 @@
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
||||
import { screen, within } from '@testing-library/react';
|
||||
import { render, server, waitFor } from '@tests/utils';
|
||||
@ -7,8 +9,7 @@ import { CMReleasesContainer } from '../CMReleasesContainer';
|
||||
|
||||
jest.mock('@strapi/helper-plugin', () => ({
|
||||
...jest.requireActual('@strapi/helper-plugin'),
|
||||
// eslint-disable-next-line
|
||||
CheckPermissions: ({ children }: { children: JSX.Element }) => <div>{children}</div>,
|
||||
CheckPermissions: jest.fn(({ children }: { children: ReactNode }) => children),
|
||||
useCMEditViewDataManager: jest.fn().mockReturnValue({
|
||||
isCreatingEntry: false,
|
||||
hasDraftAndPublish: true,
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import { useRBAC } from '@strapi/helper-plugin';
|
||||
import { within } from '@testing-library/react';
|
||||
import { render, server, screen } from '@tests/utils';
|
||||
@ -9,8 +11,7 @@ import { mockReleaseDetailsPageData } from './mockReleaseDetailsPageData';
|
||||
|
||||
jest.mock('@strapi/helper-plugin', () => ({
|
||||
...jest.requireActual('@strapi/helper-plugin'),
|
||||
// eslint-disable-next-line
|
||||
CheckPermissions: ({ children }: { children: JSX.Element }) => <div>{children}</div>,
|
||||
CheckPermissions: jest.fn(({ children }: { children: ReactNode }) => children),
|
||||
useRBAC: jest.fn(() => ({
|
||||
isLoading: false,
|
||||
allowedActions: { canUpdate: true, canDelete: true },
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import { within } from '@testing-library/react';
|
||||
import { render, server, screen } from '@tests/utils';
|
||||
import { rest } from 'msw';
|
||||
@ -8,8 +10,7 @@ import { mockReleasesPageData } from './mockReleasesPageData';
|
||||
|
||||
jest.mock('@strapi/helper-plugin', () => ({
|
||||
...jest.requireActual('@strapi/helper-plugin'),
|
||||
// eslint-disable-next-line
|
||||
CheckPermissions: ({ children }: { children: JSX.Element }) => <div>{children}</div>,
|
||||
CheckPermissions: jest.fn(({ children }: { children: ReactNode }) => children),
|
||||
}));
|
||||
|
||||
jest.mock('@strapi/admin/strapi-admin', () => ({
|
||||
|
Loading…
x
Reference in New Issue
Block a user