diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromFieldMetadata.test.ts b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromFieldMetadata.test.ts index 05c87497dcc6..62846c8fbab5 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromFieldMetadata.test.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromFieldMetadata.test.ts @@ -1,16 +1,35 @@ import { renderHook } from '@testing-library/react'; import { Nullable } from 'twenty-ui'; +import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { useColumnDefinitionsFromFieldMetadata } from '@/object-metadata/hooks/useColumnDefinitionsFromFieldMetadata'; import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { WorkspaceActivationStatus } from '~/generated/graphql'; +import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems'; +const Wrapper = getJestMetadataAndApolloMocksWrapper({ + apolloMocks: [], + onInitializeRecoilSnapshot: ({ set }) => { + set(currentWorkspaceState, { + id: '1', + featureFlags: [], + allowImpersonation: false, + activationStatus: WorkspaceActivationStatus.Active, + metadataVersion: 1, + }); + }, +}); + describe('useColumnDefinitionsFromFieldMetadata', () => { it('should return empty definitions if no object is passed', () => { const { result } = renderHook( (objectMetadataItem?: Nullable) => { return useColumnDefinitionsFromFieldMetadata(objectMetadataItem); }, + { + wrapper: Wrapper, + }, ); expect(Array.isArray(result.current.columnDefinitions)).toBe(true); @@ -32,6 +51,7 @@ describe('useColumnDefinitionsFromFieldMetadata', () => { }, { initialProps: companyObjectMetadata, + wrapper: Wrapper, }, );