Fix all broken CIs (#7439)

Fix all the broken CIs :p

This includes an ongoing effort to simplify test maintenance by having 1
unique source of truth about metadata and data mocks (that will later be
generated from a unique source of seeds: dev = demo = test)

Regressions:
- Unit line coverage: 60 > 55
- Storybook Pages branch coverage: 40 > 35
We will need to write tests to increase those coverage
- RelationFieldDisplay perf: 0.2ms to 0.22ms > We might have a
regression here
- Removed perf story about RawJSON > We will need to re-add it
This commit is contained in:
Charles Bochet
2024-10-05 00:22:38 +02:00
committed by Charles Bochet
parent bd305c8432
commit d8c4af9279
148 changed files with 4357 additions and 2536 deletions

View File

@ -1,21 +1,16 @@
import { renderHook } from '@testing-library/react';
import { useTimelineActivities } from '@/activities/timelineActivities/hooks/useTimelineActivities';
import { ReactNode } from 'react';
import { getJestHookWrapper } from '~/testing/jest/getJestHookWrapper';
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
jest.mock('@/object-record/hooks/useFindManyRecords', () => ({
useFindManyRecords: jest.fn(),
}));
const Wrappers = getJestHookWrapper({
const Wrapper = getJestMetadataAndApolloMocksWrapper({
apolloMocks: [],
});
const Wrapper = ({ children }: { children: ReactNode }) => (
<Wrappers>{children}</Wrappers>
);
describe('useTimelineActivities', () => {
afterEach(() => {
jest.clearAllMocks();

View File

@ -5,7 +5,7 @@ import { EventRowMainObjectUpdated } from '@/activities/timelineActivities/rows/
import { TimelineActivity } from '@/activities/timelineActivities/types/TimelineActivity';
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { mockedPersonObjectMetadataItem } from '~/testing/mock-data/metadata';
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
const meta: Meta<typeof EventRowMainObjectUpdated> = {
title: 'Modules/TimelineActivities/Rows/MainObject/EventRowMainObjectUpdated',
@ -35,7 +35,9 @@ const meta: Meta<typeof EventRowMainObjectUpdated> = {
},
},
} as TimelineActivity,
mainObjectMetadataItem: mockedPersonObjectMetadataItem,
mainObjectMetadataItem: generatedMockObjectMetadataItems.find(
(item) => item.namePlural === 'person',
),
},
decorators: [
ComponentDecorator,