Files
twenty/packages/twenty-server/test/integration/metadata/suites/front-component/successful-front-component-update.integration-spec.ts
T
Weiko 9aa63f7ddc Add sync front component (#17748)
## Context
Allow twenty apps to sync front components
2026-02-08 23:00:23 +00:00

69 lines
2.2 KiB
TypeScript

import { createFrontComponent } from 'test/integration/metadata/suites/front-component/utils/create-front-component.util';
import { deleteFrontComponent } from 'test/integration/metadata/suites/front-component/utils/delete-front-component.util';
import { seedBuiltFrontComponentFile } from 'test/integration/metadata/suites/front-component/utils/seed-built-front-component-file.util';
import { updateFrontComponent } from 'test/integration/metadata/suites/front-component/utils/update-front-component.util';
import { isDefined } from 'twenty-shared/utils';
describe('Front component update should succeed', () => {
let testFrontComponentId: string | undefined;
let cleanupBuiltFile: (() => void) | undefined;
beforeAll(async () => {
const { cleanup } = await seedBuiltFrontComponentFile({
builtComponentPath: 'src/front-components/index.mjs',
});
cleanupBuiltFile = cleanup;
});
afterAll(() => {
cleanupBuiltFile?.();
});
beforeEach(async () => {
const { data } = await createFrontComponent({
expectToFail: false,
input: {
name: 'testFrontComponentToUpdate',
componentName: 'TestFrontComponentToUpdate',
sourceComponentPath: 'src/front-components/index.tsx',
builtComponentPath: 'src/front-components/index.mjs',
builtComponentChecksum: 'abc123',
},
});
testFrontComponentId = data.createFrontComponent.id;
});
afterEach(async () => {
if (isDefined(testFrontComponentId)) {
await deleteFrontComponent({
expectToFail: false,
input: { id: testFrontComponentId },
});
testFrontComponentId = undefined;
}
});
it('should update front component name', async () => {
if (!isDefined(testFrontComponentId)) {
throw new Error('testFrontComponentId should be defined');
}
const { data } = await updateFrontComponent({
expectToFail: false,
input: {
id: testFrontComponentId,
update: {
name: 'updatedFrontComponentName',
},
},
});
expect(data.updateFrontComponent).toMatchObject({
id: testFrontComponentId,
name: 'updatedFrontComponentName',
});
});
});