Files
twenty/packages/twenty-server/test/integration/twenty-config/utils/delete-config-variable.util.ts
nitin 9ed6edc005 Twenty config integration tests + conversion refactor (#11972)
- In this PR the default value of IS_CONFIG_VARIABLES_IN_DB_ENABLED has
been changed to true,
    
- This is my first time writing integration tests, so I’d appreciate a
thorough review. :)
I’ve tried to follow the existing test patterns closely, but there might
be some small mistakes I may have missed.
Also let me know if I have missed any important test cases that should
be tested

UPDATE - 
### Config Value Converter Refactoring
- Created a centralized type transformers registry with bidirectional
validation
- Refactored ConfigValueConverterService to support validation in both
directions:
- Maintained existing DB-to-app conversion behavior
- Added validation for app-to-DB conversion
- Added integration tests to verify validation works in both directions

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
2025-05-13 13:34:27 +05:30

29 lines
978 B
TypeScript

import { PerformTwentyConfigQueryParams } from 'test/integration/twenty-config/types/perform-twenty-config-query.type';
import {
DeleteConfigVariableFactoryInput,
deleteConfigVariableQueryFactory,
} from './delete-config-variable.query-factory.util';
import { makeAdminPanelAPIRequest } from './make-admin-panel-api-request.util';
export const deleteConfigVariable = async ({
input,
expectToFail = false,
}: PerformTwentyConfigQueryParams<DeleteConfigVariableFactoryInput>) => {
const graphqlOperation = deleteConfigVariableQueryFactory({
key: input.key,
});
const response = await makeAdminPanelAPIRequest(graphqlOperation);
if (!expectToFail) {
expect(response.body.data).toBeDefined();
expect(response.body.errors).toBeUndefined();
expect(response.body.data.deleteDatabaseConfigVariable).toBeDefined();
} else {
expect(response.body.errors).toBeDefined();
}
return { data: response.body.data, errors: response.body.errors };
};