## Introduction After enabling flag by default got following errors: ```ts Test Suites: 48 failed, 1 skipped, 97 passed, 145 of 146 total Tests: 499 failed, 1 skipped, 644 passed, 1144 total Snapshots: 61 failed, 133 passed, 194 total Time: 363.226 s Ran all test suites. ``` ## From <img width="2952" height="1510" alt="image" src="https://github.com/user-attachments/assets/7e3b20c6-2552-40a7-90bb-2d7b3002c895" /> ## To <img width="3134" height="1510" alt="image" src="https://github.com/user-attachments/assets/4fc9ada4-3c14-4333-a1db-11daf87db8d6" /> There's a huge test bundle in the latest shard that we could split up ## Notes - Set as failing morph relation field rename as for the moment we do not handle relation field mutation - fixed the object update and creation validation adding label identifier field metadata id checks - and more Some integrations tests are still on the v1 ( they have before and after all disabling and re-enabling the flat ) but mainly we now have more coverage on the v2 than the v1. Mainly related records, uniqueness have to be migrated the v2 and so tests too
103 lines
3.3 KiB
TypeScript
103 lines
3.3 KiB
TypeScript
import { TEST_NOT_EXISTING_VIEW_ID } from 'test/integration/constants/test-view-ids.constants';
|
|
import {
|
|
assertGraphQLErrorResponseWithSnapshot,
|
|
assertGraphQLSuccessfulResponse,
|
|
} from 'test/integration/graphql/utils/graphql-test-assertions.util';
|
|
import { makeGraphqlAPIRequest } from 'test/integration/graphql/utils/make-graphql-api-request.util';
|
|
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 { updateOneObjectMetadata } from 'test/integration/metadata/suites/object-metadata/utils/update-one-object-metadata.util';
|
|
import { cleanupViewRecords } from 'test/integration/utils/view-test.util';
|
|
import { updateViewOperationFactory } from 'test/integration/graphql/utils/update-view-operation-factory.util';
|
|
import { updateViewData } from 'test/integration/graphql/utils/view-data-factory.util';
|
|
import { createOneCoreView } from 'test/integration/metadata/suites/view/utils/create-one-core-view.util';
|
|
|
|
import { ViewType } from 'src/engine/core-modules/view/enums/view-type.enum';
|
|
|
|
describe('Update core view', () => {
|
|
let testObjectMetadataId: string;
|
|
|
|
beforeAll(async () => {
|
|
const {
|
|
data: {
|
|
createOneObject: { id: objectMetadataId },
|
|
},
|
|
} = await createOneObjectMetadata({
|
|
expectToFail: false,
|
|
input: {
|
|
nameSingular: 'myViewTestObject',
|
|
namePlural: 'myViewTestObjects',
|
|
labelSingular: 'My View Test Object',
|
|
labelPlural: 'My View Test Objects',
|
|
icon: 'Icon123',
|
|
},
|
|
});
|
|
|
|
testObjectMetadataId = objectMetadataId;
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await updateOneObjectMetadata({
|
|
expectToFail: false,
|
|
input: {
|
|
idToUpdate: testObjectMetadataId,
|
|
updatePayload: {
|
|
isActive: false,
|
|
},
|
|
},
|
|
});
|
|
await deleteOneObjectMetadata({
|
|
expectToFail: false,
|
|
input: { idToDelete: testObjectMetadataId },
|
|
});
|
|
await cleanupViewRecords();
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
await cleanupViewRecords();
|
|
});
|
|
|
|
it('should update an existing view', async () => {
|
|
const {
|
|
data: { createCoreView: view },
|
|
} = await createOneCoreView({
|
|
input: {
|
|
icon: '123Icon',
|
|
name: 'Original View',
|
|
type: ViewType.TABLE,
|
|
isCompact: false,
|
|
objectMetadataId: testObjectMetadataId,
|
|
},
|
|
expectToFail: false,
|
|
});
|
|
|
|
const updateInput = updateViewData({
|
|
name: 'Updated View',
|
|
type: ViewType.KANBAN,
|
|
isCompact: true,
|
|
});
|
|
|
|
const operation = updateViewOperationFactory({
|
|
viewId: view.id,
|
|
data: updateInput,
|
|
});
|
|
const response = await makeGraphqlAPIRequest(operation);
|
|
|
|
assertGraphQLSuccessfulResponse(response);
|
|
expect(response.body.data.updateCoreView).toMatchObject({
|
|
id: view.id,
|
|
...updateInput,
|
|
});
|
|
});
|
|
|
|
it('should throw error when updating non-existent view', async () => {
|
|
const operation = updateViewOperationFactory({
|
|
viewId: TEST_NOT_EXISTING_VIEW_ID,
|
|
data: { name: 'Non-existent View' },
|
|
});
|
|
const response = await makeGraphqlAPIRequest(operation);
|
|
|
|
assertGraphQLErrorResponseWithSnapshot(response);
|
|
});
|
|
});
|