8b4b9ef8da
Forcing "type" to be explicit, works best will rollup on the frontend to exclude depdendencies
18 lines
451 B
TypeScript
18 lines
451 B
TypeScript
import { isDefined } from 'class-validator';
|
|
import { type Response } from 'supertest';
|
|
|
|
type WarnIfNoErrorButExpectedToFailInput = {
|
|
response: Response;
|
|
errorMessage: string;
|
|
};
|
|
|
|
export const warnIfNoErrorButExpectedToFail = ({
|
|
response,
|
|
errorMessage,
|
|
}: WarnIfNoErrorButExpectedToFailInput) => {
|
|
if (isDefined(response.body.data)) {
|
|
expect(false).toEqual(errorMessage);
|
|
}
|
|
expect(response.body.errors.length).toBeGreaterThan(0);
|
|
};
|