Skip to content

The open alternative to Salesforce, designed for AI.

QRQC #2 - Fix (#12054)

Etienne160eb2345498
diff --git a/packages/twenty-server/src/database/typeorm-seeds/workspace/calendar-events.ts b/packages/twenty-server/src/database/typeorm-seeds/workspace/calendar-events.ts
index fd4b0c729fd..bdb374ce2cb 100644
--- a/packages/twenty-server/src/database/typeorm-seeds/workspace/calendar-events.ts
+++ b/packages/twenty-server/src/database/typeorm-seeds/workspace/calendar-events.ts
@@ -2,6 +2,10 @@ import { WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/wor
const tableName = 'calendarEvent';
+export const DEV_SEED_CALENDAR_EVENT_IDS = {
+ CALENDAR_EVENT_1: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
+};
+
export const seedCalendarEvents = async (
entityManager: WorkspaceEntityManager,
schemaName: string,
@@ -30,7 +34,7 @@ export const seedCalendarEvents = async (
.orIgnore()
.values([
{
- id: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
+ id: DEV_SEED_CALENDAR_EVENT_IDS.CALENDAR_EVENT_1,
title: 'Meeting with Christoph',
isCanceled: false,
isFullDay: false,
diff --git a/packages/twenty-server/test/integration/constants/calendar-event-gql-fields.constants.ts b/packages/twenty-server/test/integration/constants/calendar-event-gql-fields.constants.ts
new file mode 100644
index 00000000000..70e91336c0f
--- /dev/null
+++ b/packages/twenty-server/test/integration/constants/calendar-event-gql-fields.constants.ts
@@ -0,0 +1,9 @@
+export const CALENDAR_EVENT_GQL_FIELDS = `
+ id
+ title
+ description
+ endsAt
+ startsAt
+ createdAt
+ updatedAt
+ deletedAt`;
diff --git a/packages/twenty-server/test/integration/constants/message-gql-fields.constants.ts b/packages/twenty-server/test/integration/constants/message-gql-fields.constants.ts
new file mode 100644
index 00000000000..1bf762b1773
--- /dev/null
+++ b/packages/twenty-server/test/integration/constants/message-gql-fields.constants.ts
@@ -0,0 +1,7 @@
+export const MESSAGE_GQL_FIELDS = `
+ id
+ subject
+ text
+ createdAt
+ updatedAt
+ deletedAt`;
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/__snapshots__/calendar-events.integration-spec.ts.snap b/packages/twenty-server/test/integration/graphql/suites/object-generated/__snapshots__/calendar-events.integration-spec.ts.snap
new file mode 100644
index 00000000000..c8380de991f
--- /dev/null
+++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/__snapshots__/calendar-events.integration-spec.ts.snap
@@ -0,0 +1,27 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`calendarEventsResolver (e2e) should find many calendarEvents 1`] = `
+{
+ "createdAt": Any<String>,
+ "deletedAt": null,
+ "description": "Discuss project progress",
+ "endsAt": Any<String>,
+ "id": "86083141-1c0e-494c-a1b6-85b1c6fefaa5",
+ "startsAt": Any<String>,
+ "title": "Meeting with Christoph",
+ "updatedAt": Any<String>,
+}
+`;
+
+exports[`calendarEventsResolver (e2e) should find one calendarEvent 1`] = `
+{
+ "createdAt": Any<String>,
+ "deletedAt": null,
+ "description": "Discuss project progress",
+ "endsAt": Any<String>,
+ "id": "86083141-1c0e-494c-a1b6-85b1c6fefaa5",
+ "startsAt": Any<String>,
+ "title": "Meeting with Christoph",
+ "updatedAt": Any<String>,
+}
+`;
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/__snapshots__/messages.integration-spec.ts.snap b/packages/twenty-server/test/integration/graphql/suites/object-generated/__snapshots__/messages.integration-spec.ts.snap
new file mode 100644
index 00000000000..5e654ca389b
--- /dev/null
+++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/__snapshots__/messages.integration-spec.ts.snap
@@ -0,0 +1,29 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`messagesResolver (e2e) should find many messages 1`] = `
+{
+ "createdAt": Any<String>,
+ "deletedAt": null,
+ "id": "20202020-04c8-4f24-93f2-764948e95014",
+ "subject": "Inquiry Regarding Topic",
+ "text": "Good Morning,
+ I am writing to inquire about information. Could you please provide me with details regarding this topic?
+ Your assistance in this matter would be greatly appreciated. Thank you in advance for your prompt response.
+ Best regards,Tim",
+ "updatedAt": Any<String>,
+}
+`;
+
+exports[`messagesResolver (e2e) should find one message 1`] = `
+{
+ "createdAt": Any<String>,
+ "deletedAt": null,
+ "id": "20202020-2b8a-405d-8f42-e820ca921421",
+ "subject": "Meeting Request",
+ "text": "Hello,
+ I hope this email finds you well. I am writing to request a meeting. I believe it would be beneficial for both parties to collaborate and explore potential opportunities. Would you be available for a meeting sometime next week? Please let me know your availability, and I will arrange a suitable time.
+ Looking forward to your response.
+ Best regards",
+ "updatedAt": Any<String>,
+}
+`;
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-events.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-events.integration-spec.ts
new file mode 100644
index 00000000000..e9833d69b41
--- /dev/null
+++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-events.integration-spec.ts
@@ -0,0 +1,56 @@
+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 { DEV_SEED_CALENDAR_EVENT_IDS } from 'src/database/typeorm-seeds/workspace/calendar-events';
+
+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(1);
+
+ const calendarEvent = edges[0].node;
+
+ expect(calendarEvent).toMatchSnapshot({
+ createdAt: expect.any(String),
+ endsAt: expect.any(String),
+ startsAt: expect.any(String),
+ updatedAt: expect.any(String),
+ });
+ });
+
+ it('should find one calendarEvent', async () => {
+ const graphqlOperation = findOneOperationFactory({
+ objectMetadataSingularName: 'calendarEvent',
+ filter: { id: { eq: DEV_SEED_CALENDAR_EVENT_IDS.CALENDAR_EVENT_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),
+ });
+ });
+});
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/messages.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/messages.integration-spec.ts
new file mode 100644
index 00000000000..fd25523402e
--- /dev/null
+++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/messages.integration-spec.ts
@@ -0,0 +1,52 @@
+import { MESSAGE_GQL_FIELDS } from 'test/integration/constants/message-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 { DEV_SEED_MESSAGE_IDS } from 'src/database/typeorm-seeds/workspace/messages';
+
+describe('messagesResolver (e2e)', () => {
+ it('should find many messages', async () => {
+ const graphqlOperation = findManyOperationFactory({
+ objectMetadataSingularName: 'message',
+ objectMetadataPluralName: 'messages',
+ gqlFields: MESSAGE_GQL_FIELDS,
+ });
+
+ const response = await makeGraphqlAPIRequest(graphqlOperation);
+
+ const data = response.body.data.messages;
+
+ expect(data).toBeDefined();
+ expect(Array.isArray(data.edges)).toBe(true);
+
+ const edges = data.edges;
+
+ expect(edges.length).toEqual(3);
+
+ const message1 = edges[0].node;
+
+ expect(message1).toMatchSnapshot({
+ createdAt: expect.any(String),
+ updatedAt: expect.any(String),
+ });
+ });
+
+ it('should find one message', async () => {
+ const graphqlOperation = findOneOperationFactory({
+ objectMetadataSingularName: 'message',
+ filter: { id: { eq: DEV_SEED_MESSAGE_IDS.MESSAGE_1 } },
+ gqlFields: MESSAGE_GQL_FIELDS,
+ });
+
+ const response = await makeGraphqlAPIRequest(graphqlOperation);
+
+ const data = response.body.data.message;
+
+ expect(data).toBeDefined();
+ expect(data).toMatchSnapshot({
+ createdAt: expect.any(String),
+ updatedAt: expect.any(String),
+ });
+ });
+});