Files
twenty/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-events.integration-spec.ts
Félix Malfait ea226f9e71 Fix flaky calendar test (#12760)
Test was flaky because sometimes a calendar event is associated to an
account which the user does not have access to

Removing the snapshot to test the exact response value but the test is
still there (more flexible)
2025-06-20 15:30:42 +02:00

61 lines
2.1 KiB
TypeScript

import { CALENDAR_EVENT_GQL_FIELDS } from 'test/integration/constants/calendar-event-gql-fields.constants';
import { findManyOperationFactory } from 'test/integration/graphql/utils/find-many-operation-factory.util';
import { findOneOperationFactory } from 'test/integration/graphql/utils/find-one-operation-factory.util';
import { makeGraphqlAPIRequest } from 'test/integration/graphql/utils/make-graphql-api-request.util';
import { CALENDAR_EVENT_DATA_SEED_IDS } from 'src/engine/workspace-manager/dev-seeder/data/constants/calendar-event-data-seeds.constant';
describe('calendarEventsResolver (e2e)', () => {
it('should find many calendarEvents', async () => {
const graphqlOperation = findManyOperationFactory({
objectMetadataSingularName: 'calendarEvent',
objectMetadataPluralName: 'calendarEvents',
gqlFields: CALENDAR_EVENT_GQL_FIELDS,
});
const response = await makeGraphqlAPIRequest(graphqlOperation);
const data = response.body.data.calendarEvents;
expect(data).toBeDefined();
expect(Array.isArray(data.edges)).toBe(true);
const edges = data.edges;
expect(edges.length).toEqual(60);
const calendarEvent = edges[0].node;
expect(calendarEvent).toMatchSnapshot({
createdAt: expect.any(String),
endsAt: expect.any(String),
startsAt: expect.any(String),
updatedAt: expect.any(String),
title: expect.any(String),
description: expect.any(String),
});
});
it('should find one calendarEvent', async () => {
const graphqlOperation = findOneOperationFactory({
objectMetadataSingularName: 'calendarEvent',
filter: { id: { eq: CALENDAR_EVENT_DATA_SEED_IDS.ID_1 } },
gqlFields: CALENDAR_EVENT_GQL_FIELDS,
});
const response = await makeGraphqlAPIRequest(graphqlOperation);
const data = response.body.data.calendarEvent;
expect(data).toBeDefined();
expect(data).toMatchSnapshot({
createdAt: expect.any(String),
endsAt: expect.any(String),
startsAt: expect.any(String),
updatedAt: expect.any(String),
title: expect.any(String),
description: expect.any(String),
});
});
});