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:
@ -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;
|
||||
};
|
||||
@ -7,5 +7,6 @@
|
||||
* |___/
|
||||
*/
|
||||
|
||||
export { eachTestingContextFilter } from './EachTestingContextFilter';
|
||||
export type { EachTestingContext } from './types/EachTestingContext.type';
|
||||
export type { SuccessfulAndFailingTestCases } from './types/SuccessfulAndFailingTestCases';
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
export type EachTestingContext<T> = {
|
||||
title: string;
|
||||
context: T;
|
||||
only?: true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user