[TEST] Covering useDeleteOne relations optimistic cache behavior (#10238)

## Introduction
Added coverage on the `useDeleteOneRecord` hooks, especially its
optimistic behavior feature.
Introduced a new testing tool `InMemoryTestingCacheInstance` that has
builtin very basic expectors in order to avoid future duplication when
covering others record hooks `update, create, destroy` etc etc

## Notes
Added few comments in this PR regarding some builtin functions I've
created around companies and people mocked object model and that I think
could be cool to spread and centralize within a dedicated "class
template"

Also put in light that unless I'm mistaken some tests are running on
`RecordNode` and not `RecordObject`

Took few directions on my own that as I always I would suggestion nor
remarks on them !

Let me know

## Misc
- Should we refactor `useDeleteOneRecord` tests to follow `eachTesting`
pattern ? => I feel like this is inappropriate as this hooks is already
high level, the only plus value would be less tests code despite
readability IMO
This commit is contained in:
Paul Rastoin
2025-03-03 10:22:26 +01:00
committed by GitHub
parent c6e5238d71
commit 2e4c596644
30 changed files with 2989 additions and 289 deletions

View File

@ -9,7 +9,7 @@ import { prefetchViewsState } from '@/prefetch/states/prefetchViewsState';
import { AppPath } from '@/types/AppPath';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { ViewType } from '@/views/types/ViewType';
import { getCompanyObjectMetadataItem } from '~/testing/mock-data/companies';
import { getMockCompanyObjectMetadataItem } from '~/testing/mock-data/companies';
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
import { mockedUserData } from '~/testing/mock-data/users';
@ -35,7 +35,7 @@ const renderHooks = ({
{
id: 'viewId',
name: 'Test View',
objectMetadataId: getCompanyObjectMetadataItem().id,
objectMetadataId: getMockCompanyObjectMetadataItem().id,
type: ViewType.Table,
key: null,
isCompact: false,