Files
twenty/packages/twenty-server/test/integration/metadata/utils/warn-if-error-but-not-expected-to-fail.util.ts
T
Paul Rastoin 7edfe4bc7a [Followup] Fix defaultValue with enum options update in migration v2 integration test + polish (#15300)
# Introduction
Followup of https://github.com/twentyhq/twenty/pull/15286

- Polish replacing sorting by conditional filter and push
- Integration test
2025-10-23 17:57:41 +02:00

25 lines
720 B
TypeScript

import { type Response } from 'supertest';
import { isDefined } from 'twenty-shared/utils';
type WarnIfErrorButNotExpectedToFailInput = {
response: Response;
errorMessage: string;
};
export const warnIfErrorButNotExpectedToFail = ({
response,
errorMessage,
}: WarnIfErrorButNotExpectedToFailInput) => {
if (isDefined(response.body.errors) && response.body.errors.length > 0) {
if (
isDefined(process.env.LOG_LEVELS) &&
process.env.LOG_LEVELS.includes('debug')
) {
// eslint-disable-next-line no-console
console.log(JSON.stringify(response.body.errors, null, 2));
}
expect(response.body.errors).toEqual(errorMessage);
}
expect(response.body.data).toBeDefined();
};