8b4b9ef8da
Forcing "type" to be explicit, works best will rollup on the frontend to exclude depdendencies
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { createOneObjectMetadata } from 'test/integration/metadata/suites/object-metadata/utils/create-one-object-metadata.util';
|
|
import { deleteOneObjectMetadata } from 'test/integration/metadata/suites/object-metadata/utils/delete-one-object-metadata.util';
|
|
import { getMockCreateObjectInput } from 'test/integration/metadata/suites/object-metadata/utils/generate-mock-create-object-metadata-input';
|
|
import { type EachTestingContext } from 'twenty-shared/testing';
|
|
|
|
import { type CreateObjectInput } from 'src/engine/metadata-modules/object-metadata/dtos/create-object.input';
|
|
|
|
type CreateObjectInputPayload = Omit<
|
|
CreateObjectInput,
|
|
'workspaceId' | 'dataSourceId'
|
|
>;
|
|
|
|
type CreateOneObjectMetadataItemTestingContext = EachTestingContext<
|
|
Partial<CreateObjectInputPayload>
|
|
>[];
|
|
const successfulObjectMetadataItemCreateOneUseCase: CreateOneObjectMetadataItemTestingContext =
|
|
[
|
|
{
|
|
title: 'with basic input',
|
|
context: {},
|
|
},
|
|
// TODO populate
|
|
];
|
|
|
|
const allTestsUseCases = [...successfulObjectMetadataItemCreateOneUseCase];
|
|
|
|
describe('Object metadata creation should succeed', () => {
|
|
it.each(allTestsUseCases)('$title', async ({ context }) => {
|
|
const { data } = await createOneObjectMetadata({
|
|
input: getMockCreateObjectInput(context),
|
|
});
|
|
|
|
expect(data.createOneObject.id).toBeDefined();
|
|
await deleteOneObjectMetadata({
|
|
input: { idToDelete: data.createOneObject.id },
|
|
}).catch();
|
|
});
|
|
});
|