Workspace migration v2 testing (#13136)

# Introduction
Introduced `EachTesting` pattern for the builder unit tests.
As always any suggestions are more than welcomed !


Still need to:
- [x] implem basic tests for field
- [x] create `get-flat-index-field-metadata.mock.ts`
- [x] Implement basic tests for index and index-fields
- [ ] Implem standard edges cases tests TDD style

## Misc
- was https://github.com/twentyhq/twenty/pull/13132 closed due to mess
to rebase on main
This commit is contained in:
Paul Rastoin
2025-07-15 16:08:50 +02:00
committed by GitHub
parent 2c7a459634
commit c5a74b8e92
25 changed files with 3013 additions and 1575 deletions

View File

@ -0,0 +1,20 @@
import { EachTestingContext } from '@/testing/types/EachTestingContext.type';
export const eachTestingContextFilter = <T>(
testCases: EachTestingContext<T>[],
) => {
const onlyTestsCases = testCases.filter((testCase) => testCase.only === true);
if (process.env.CI && onlyTestsCases.length > 0) {
console.warn(
'Should never push tests cases with an only to true, only to use in dev env\n returning the whole test suite anyway',
);
return testCases;
}
if (onlyTestsCases.length > 0) {
return onlyTestsCases;
}
return testCases;
};

View File

@ -7,5 +7,6 @@
* |___/
*/
export { eachTestingContextFilter } from './EachTestingContextFilter';
export type { EachTestingContext } from './types/EachTestingContext.type';
export type { SuccessfulAndFailingTestCases } from './types/SuccessfulAndFailingTestCases';

View File

@ -1,4 +1,5 @@
export type EachTestingContext<T> = {
title: string;
context: T;
only?: true;
};