Files
twenty/packages/twenty-server/test/integration/rest/utils/page-layout-tab-rest-api.util.ts
T
nitinandGitHub 44f97058ac Tidy up validation for configuration (#14939)
closes https://github.com/twentyhq/core-team-issues/issues/1605

TODO:  
~~- add stories~~
~~- add base graph on companies when creating a new graph widget~~
2025-10-09 20:34:51 +00:00

40 lines
1.2 KiB
TypeScript

import { makeRestAPIRequest } from 'test/integration/rest/utils/make-rest-api-request.util';
import { generateRecordName } from 'test/integration/utils/generate-record-name';
import { type PageLayoutTabEntity } from 'src/engine/core-modules/page-layout/entities/page-layout-tab.entity';
export const createTestPageLayoutTabWithRestApi = async (
overrides: Partial<PageLayoutTabEntity> = {},
): Promise<PageLayoutTabEntity> => {
const pageLayoutTabData = {
title: generateRecordName('Test Page Layout Tab'),
position: 0,
...overrides,
};
const response = await makeRestAPIRequest({
method: 'post',
path: '/metadata/pageLayoutTabs',
body: pageLayoutTabData,
bearer: API_KEY_ACCESS_TOKEN,
});
if (response.status !== 201) {
throw new Error(
`Failed to create test page layout tab: ${response.status} - ${JSON.stringify(response.body)}`,
);
}
return response.body;
};
export const deleteTestPageLayoutTabWithRestApi = async (
pageLayoutTabId: string,
): Promise<void> => {
await makeRestAPIRequest({
method: 'delete',
path: `/metadata/pageLayoutTabs/${pageLayoutTabId}`,
bearer: API_KEY_ACCESS_TOKEN,
});
};