diff --git a/packages/twenty-server/.env.test b/packages/twenty-server/.env.test index b8fb82f4c8..e768984fbd 100644 --- a/packages/twenty-server/.env.test +++ b/packages/twenty-server/.env.test @@ -11,7 +11,7 @@ EXCEPTION_HANDLER_DRIVER=console SENTRY_DSN=https://ba869cb8fd72d5faeb6643560939cee0@o4505516959793152.ingest.sentry.io/4506660900306944 DEMO_WORKSPACE_IDS=63db4589-590f-42b3-bdf1-85268b3da02f,8de58f3f-7e86-4a0b-998d-b2cbe314ee3a,4d957b72-0b37-4bad-9468-8dc828ee082d,daa0b739-269e-49b6-9be5-5f0215941489,59c15f6a-909a-4495-9cf4-3ce1b0abbb6a,7202cc9d-92da-4b52-a323-d29d38cd3b4e,5f071b0d-646b-411a-94f1-5d9ba9d5c6ac,7bc10973-897b-4767-ab2f-35cdac3b2aec,4b3ba0be-2d29-4b1e-be66-8ac7eb65d000,edfb500d-cc4e-4f22-8e2b-f139a9758a68,eee459c9-9057-4459-ae0d-d51d14c01635,3dd2f505-0075-4217-ba33-fc4244aeaaa9,3d1a9165-3f3f-494e-a99d-f858eae95144,84db6ded-cfce-4aee-9160-6553b05c8143,96fb1540-269b-4d13-af21-2a8268eff8ca,b2463e69-d121-4ea5-80c9-bba82403e93e,5af30c15-867d-49ed-b939-d4856bed8514,b5677aa1-68fa-4818-aaaa-434a07ae2ed4,1ec7fa9a-d6bf-4fa2-a753-9a235d75ee3f,753a6fa2-df27-4c87-8c90-4da78fcb30dd,2138f2f2-bbe9-41df-b483-687a9075f94e,a885cfef-4636-4c3a-9788-1ff6e6b92df5,5458f7fb-9431-47a2-b7a0-32f31d115e23,6c09929f-11c3-4f92-9508-aa0e6b934d1e,57ae0a2c-7a4e-4c7d-8f43-68548e7f1206,cc7f0b85-6868-4c2d-85c5-3ce9977ea346,21871a7f-f067-45ea-989e-44339bb5ad07,c3efedab-84f5-4656-8297-55964b3d26cb,647dcdd1-4540-4003-9f58-fd84d4d759b7,fc5e6857-8d67-47b8-98f2-edeb0671e326,1ad8d72c-1826-40ed-8b44-d15a1d2aab70,eac6c90a-d25d-4c8c-a053-cfbc7cde0afb,023a70de-a85e-43fc-bbc6-757fbf6562f0,f3f0a7fb-1409-443b-8e39-4e58e628796e,62828804-97d4-40ec-82fa-2992a6ce4a81,af5441fe-b16f-4996-87f4-1a433ec53dd6,e8857860-f7b1-4478-9741-1eb9e7c11f2c,6bca9c44-c8c0-49f8-b0b5-1bb2ca7842b8,d50da092-09df-448f-84ea-3ebddfe1d9f6,9efd5d6d-db64-47d4-9ad3-5e4d8b65ff7f,6f089094-2dd2-4b0e-b5b7-8bb52b93ea8e,299b0822-68e9-4bfa-af35-da799012e80e,a3dd579c-93be-45a0-ad35-f518d8ed45dd,023b1b3e-4891-4061-aae0-f34368644f40,50174445-33c5-4482-bb8c-3ef6c511c8cd,9933c048-07a7-4735-9af2-940c2f9b6683,beadc568-3962-46bd-ad4d-06e23b37615b,0cdafc9f-d4c1-4576-837e-d7f6ec28643d,50bb24ce-1709-4928-a87b-d9d9e147a2ab,7690ed72-910d-4357-8e0e-17aa702b0b94,1ad0d69f-60fa-414f-bf79-4f94c2abba43,946d84a4-db4d-48cb-a5d3-03081b5c7e8e,1a080055-d2bf-4b14-8957-88a7d08769b8,ed343e38-e405-4fae-9486-27b09c98bdad,c8bdef75-a98c-4646-a372-3251340d2dea,87a8c6fa-f93e-4950-aff2-5f956ca1a6ba,604781ba-23c2-4220-a717-b5615431fcd9,31af6841-ad9f-4f28-a637-b5c5e6589447,cf067451-7b88-4ff2-a96d-3fc9c5d6fea0,26a8ad5e-29d9-4e7d-aa1f-e6221e8ea32a,fd14db29-e4df-44a7-9b3f-d00384458122,73b477a8-fcf4-4860-a685-65a0a79b8653,82e0f305-4c6c-4160-be1d-b0de834124e6,e38567ab-a6e2-4a94-99c5-a7db31c0aae8,faf3d6dc-66ff-4c1b-9658-f65a9cd9fcf1,6df6bb90-200e-4290-b73d-9bb374554229,2ff10cf4-a871-404a-9e7b-5ca7a232567e,06c614e2-0f36-4b72-8c82-59631680add2,5e508c81-3453-4185-ae8c-4c9b841f8c15,21b5c371-6010-4b1b-be67-7538eb877efb,54e61442-e291-4eea-8d49-7f11b5f85bd2,b6b7260a-4eea-40b0-9f7f-1dfd4c3cc7a8,e163fe76-30fb-44fb-b51a-50cc78745a21,4da672f2-29b4-4a98-b27c-b39a4aecc858,2fdb0601-c882-4aaf-ad49-ae17e530d47a,49525e1b-1b47-4545-a98c-0ba58778179f,f958ab32-b152-4004-9228-18148f7380f1,0ff5025a-62cd-4a10-a722-79f7cf360f01,642df445-e314-409a-a97d-64fc2aa2a15e,38b0dab5-d4fb-44f9-8cf9-bb35cf82e91d,62054133-f35a-4f64-a2ee-a31e48952835,536dbe8c-af33-4eab-a0a8-8d039a00db40,a04998ba-52c9-4538-b6d9-6d04408dbaf2,89016c7a-3d36-4619-a5c6-4f31795eebf7,7708b9a9-776c-46fc-94a4-dc28e7880958,5c92bc69-b328-4c66-a791-a05dbaf7a6f8,ad580a50-80b4-44be-9bc4-f2b57cd23207,36c0241c-891e-4b74-bd10-5e99df96bbc8,a96842ff-18be-4536-a23d-20d973d91621,0ea549b0-9558-4bdf-9944-5abc707c7660,0186c353-5ed2-4c94-b71a-fc0b48c90288,1508a165-2217-4911-b31c-1ea42a08f097,1731e392-dfdf-4fc4-863b-27ae62b0e374,0b245cea-96a6-4a3a-af6a-ef43496c239c,a844e208-7078-43a2-8bd0-86f31498cd3f,53d112b5-87f2-490b-a788-df1f4624f9ad,0d5794d4-3a52-482b-9a6a-f8185018bad1,df877aa6-231c-47fb-9be0-906e61677356,c56c6d1a-3418-49d2-82ce-bd9370668043,6e0b6f34-3cd0-4aa0-ae1f-25f5545dca68 MUTATION_MAXIMUM_RECORD_AFFECTED=100 -MESSAGE_QUEUE_TYPE=pg-boss +MESSAGE_QUEUE_TYPE=bull-mq CACHE_STORAGE_TYPE=redis REDIS_URL=redis://localhost:6379 diff --git a/packages/twenty-server/felix b/packages/twenty-server/felix deleted file mode 160000 index a33b017977..0000000000 --- a/packages/twenty-server/felix +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a33b01797795419edef84f122b5214472648d1ce diff --git a/packages/twenty-server/jest-integration.config.ts b/packages/twenty-server/jest-integration.config.ts index 10b5cc9e20..deb2ba3ee5 100644 --- a/packages/twenty-server/jest-integration.config.ts +++ b/packages/twenty-server/jest-integration.config.ts @@ -11,11 +11,14 @@ const jestConfig: JestConfigWithTsJest = { testEnvironment: 'node', testRegex: '.integration-spec.ts$', modulePathIgnorePatterns: ['/dist'], - globalSetup: '/test/utils/setup-test.ts', - globalTeardown: '/test/utils/teardown-test.ts', + globalSetup: '/test/integration/utils/setup-test.ts', + globalTeardown: '/test/integration/utils/teardown-test.ts', testTimeout: 15000, moduleNameMapper: { - ...pathsToModuleNameMapper(tsConfig.compilerOptions.paths), + ...pathsToModuleNameMapper(tsConfig.compilerOptions.paths, { + prefix: '/../..', + }), + '^test/(.*)$': '/test/$1', 'twenty-emails': '/../twenty-emails/dist/index.js', }, fakeTimers: { diff --git a/packages/twenty-server/project.json b/packages/twenty-server/project.json index ed8ad716b6..de8dec76a9 100644 --- a/packages/twenty-server/project.json +++ b/packages/twenty-server/project.json @@ -162,7 +162,7 @@ "options": { "cwd": "packages/twenty-server", "commands": [ - "nx ts-node-no-deps -- ./scripts/generate-integration-tests/index.ts" + "nx ts-node-no-deps -- ./test/integration/graphql/codegen/index.ts" ], "parallel": false } diff --git a/packages/twenty-server/test/company.integration-spec.ts b/packages/twenty-server/test/company.integration-spec.ts deleted file mode 100644 index bd25d66eb4..0000000000 --- a/packages/twenty-server/test/company.integration-spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -import request from 'supertest'; - -const graphqlClient = request(`http://localhost:${APP_PORT}`); - -describe('CompanyResolver (integration)', () => { - it('should find many companies', () => { - const queryData = { - query: ` - query Companies { - companies { - edges { - node { - id - name - } - } - } - } - `, - }; - - return graphqlClient - .post('/graphql') - .set('Authorization', `Bearer ${ACCESS_TOKEN}`) - .send(queryData) - .expect(200) - .expect((res) => { - expect(res.body.data).toBeDefined(); - expect(res.body.errors).toBeUndefined(); - }) - .expect((res) => { - const data = res.body.data.companies; - - expect(data).toBeDefined(); - expect(Array.isArray(data.edges)).toBe(true); - - const edges = data.edges; - - if (edges.length > 0) { - const company = edges[0].node; - - expect(company).toBeDefined(); - expect(company).toHaveProperty('id'); - expect(company).toHaveProperty('name'); - } - }); - }); -}); diff --git a/packages/twenty-server/scripts/generate-integration-tests/index.ts b/packages/twenty-server/test/integration/graphql/codegen/index.ts similarity index 98% rename from packages/twenty-server/scripts/generate-integration-tests/index.ts rename to packages/twenty-server/test/integration/graphql/codegen/index.ts index 5b635d3bcc..9f1937cae2 100644 --- a/packages/twenty-server/scripts/generate-integration-tests/index.ts +++ b/packages/twenty-server/test/integration/graphql/codegen/index.ts @@ -13,7 +13,7 @@ import { const GRAPHQL_URL = 'http://localhost:3000/graphql'; const BEARER_TOKEN = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC05ZTNiLTQ2ZDQtYTU1Ni04OGI5ZGRjMmIwMzQiLCJ3b3Jrc3BhY2VJZCI6IjIwMjAyMDIwLTFjMjUtNGQwMi1iZjI1LTZhZWNjZjdlYTQxOSIsIndvcmtzcGFjZU1lbWJlcklkIjoiMjAyMDIwMjAtMDY4Ny00YzQxLWI3MDctZWQxYmZjYTk3MmE3IiwiaWF0IjoxNzI2NDkyNTAyLCJleHAiOjEzMjQ1MDE2NTAyfQ.zM6TbfeOqYVH5Sgryc2zf02hd9uqUOSL1-iJlMgwzsI'; -const TEST_OUTPUT_DIR = './test'; +const TEST_OUTPUT_DIR = './test/integration/graphql/suites/object-generated'; const fetchGraphQLSchema = async (): Promise => { const headers = { diff --git a/packages/twenty-server/scripts/generate-integration-tests/introspection-query.ts b/packages/twenty-server/test/integration/graphql/codegen/introspection-query.ts similarity index 100% rename from packages/twenty-server/scripts/generate-integration-tests/introspection-query.ts rename to packages/twenty-server/test/integration/graphql/codegen/introspection-query.ts diff --git a/packages/twenty-server/scripts/generate-integration-tests/introspection.interface.ts b/packages/twenty-server/test/integration/graphql/codegen/introspection.interface.ts similarity index 100% rename from packages/twenty-server/scripts/generate-integration-tests/introspection.interface.ts rename to packages/twenty-server/test/integration/graphql/codegen/introspection.interface.ts diff --git a/packages/twenty-server/test/integration/graphql/suites/all-resolvers.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/all-resolvers.integration-spec.ts new file mode 100644 index 0000000000..3b1a46f89a --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/all-resolvers.integration-spec.ts @@ -0,0 +1,430 @@ +import { createManyOperationFactory } from 'test/integration/graphql/utils/create-many-operation-factory.util'; +import { createOneOperationFactory } from 'test/integration/graphql/utils/create-one-operation-factory.util'; +import { deleteManyOperationFactory } from 'test/integration/graphql/utils/delete-many-operation-factory.util'; +import { deleteOneOperationFactory } from 'test/integration/graphql/utils/delete-one-operation-factory.util'; +import { destroyManyOperationFactory } from 'test/integration/graphql/utils/destroy-many-operation-factory.util'; +import { destroyOneOperationFactory } from 'test/integration/graphql/utils/destroy-one-operation-factory.util'; +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 { updateManyOperationFactory } from 'test/integration/graphql/utils/update-many-operation-factory.util'; +import { updateOneOperationFactory } from 'test/integration/graphql/utils/update-one-operation-factory.util'; +import { generateRecordName } from 'test/integration/utils/generate-record-name'; + +const COMPANY_1_ID = '777a8457-eb2d-40ac-a707-551b615b6987'; +const COMPANY_2_ID = '777a8457-eb2d-40ac-a707-551b615b6988'; +const COMPANY_3_ID = '777a8457-eb2d-40ac-a707-551b615b6989'; +const COMPANY_GQL_FIELDS = ` + id + name + employees + idealCustomerProfile + position + createdAt + updatedAt + deletedAt + accountOwnerId + tagline + workPolicy + visaSponsorship +`; + +describe('companies resolvers (integration)', () => { + it('1. should create and return companies', async () => { + const companyName1 = generateRecordName(COMPANY_1_ID); + const companyName2 = generateRecordName(COMPANY_2_ID); + + const graphqlOperation = createManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + data: [ + { + id: COMPANY_1_ID, + name: companyName1, + }, + { + id: COMPANY_2_ID, + name: companyName2, + }, + ], + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.createCompanies).toHaveLength(2); + + response.body.data.createCompanies.forEach((company) => { + expect(company).toHaveProperty('name'); + expect([companyName1, companyName2]).toContain(company.name); + + expect(company).toHaveProperty('employees'); + expect(company).toHaveProperty('idealCustomerProfile'); + expect(company).toHaveProperty('position'); + expect(company).toHaveProperty('id'); + expect(company).toHaveProperty('createdAt'); + expect(company).toHaveProperty('updatedAt'); + expect(company).toHaveProperty('deletedAt'); + expect(company).toHaveProperty('accountOwnerId'); + expect(company).toHaveProperty('tagline'); + expect(company).toHaveProperty('workPolicy'); + expect(company).toHaveProperty('visaSponsorship'); + }); + }); + + it('1b. should create and return one company', async () => { + const companyName = generateRecordName(COMPANY_3_ID); + + const graphqlOperation = createOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + data: { + id: COMPANY_3_ID, + name: companyName, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + const createdCompany = response.body.data.createCompany; + + expect(createdCompany).toHaveProperty('name'); + expect(createdCompany.name).toEqual(companyName); + + expect(createdCompany).toHaveProperty('employees'); + expect(createdCompany).toHaveProperty('idealCustomerProfile'); + expect(createdCompany).toHaveProperty('position'); + expect(createdCompany).toHaveProperty('id'); + expect(createdCompany).toHaveProperty('createdAt'); + expect(createdCompany).toHaveProperty('updatedAt'); + expect(createdCompany).toHaveProperty('deletedAt'); + expect(createdCompany).toHaveProperty('accountOwnerId'); + expect(createdCompany).toHaveProperty('tagline'); + expect(createdCompany).toHaveProperty('workPolicy'); + expect(createdCompany).toHaveProperty('visaSponsorship'); + }); + + it('2. should find many companies', async () => { + const graphqlOperation = findManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + const data = response.body.data.companies; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const companies = edges[0].node; + + expect(companies).toHaveProperty('name'); + expect(companies).toHaveProperty('employees'); + expect(companies).toHaveProperty('idealCustomerProfile'); + expect(companies).toHaveProperty('position'); + expect(companies).toHaveProperty('id'); + expect(companies).toHaveProperty('createdAt'); + expect(companies).toHaveProperty('updatedAt'); + expect(companies).toHaveProperty('deletedAt'); + expect(companies).toHaveProperty('accountOwnerId'); + expect(companies).toHaveProperty('tagline'); + expect(companies).toHaveProperty('workPolicy'); + expect(companies).toHaveProperty('visaSponsorship'); + } + }); + + it('2b. should find one company', async () => { + const graphqlOperation = findOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + eq: COMPANY_3_ID, + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + const company = response.body.data.company; + + expect(company).toHaveProperty('name'); + + expect(company).toHaveProperty('employees'); + expect(company).toHaveProperty('idealCustomerProfile'); + expect(company).toHaveProperty('position'); + expect(company).toHaveProperty('id'); + expect(company).toHaveProperty('createdAt'); + expect(company).toHaveProperty('updatedAt'); + expect(company).toHaveProperty('deletedAt'); + expect(company).toHaveProperty('accountOwnerId'); + expect(company).toHaveProperty('tagline'); + expect(company).toHaveProperty('workPolicy'); + expect(company).toHaveProperty('visaSponsorship'); + }); + + it('3. should update many companies', async () => { + const graphqlOperation = updateManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + data: { + employees: 123, + }, + filter: { + id: { + in: [COMPANY_1_ID, COMPANY_2_ID], + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + const updatedCompanies = response.body.data.updateCompanies; + + expect(updatedCompanies).toHaveLength(2); + + updatedCompanies.forEach((company) => { + expect(company.employees).toEqual(123); + }); + }); + + it('3b. should update one company', async () => { + const graphqlOperation = updateOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + data: { + employees: 122, + }, + recordId: COMPANY_3_ID, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + const updatedCompany = response.body.data.updateCompany; + + expect(updatedCompany.employees).toEqual(122); + }); + + it('4. should find many companies with updated employees', async () => { + const graphqlOperation = findManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + employees: { + eq: 123, + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.companies.edges).toHaveLength(2); + }); + + it('4b. should find one company with updated employees', async () => { + const graphqlOperation = findOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + employees: { + eq: 122, + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.company.employees).toEqual(122); + }); + + it('5. should delete many companies', async () => { + const graphqlOperation = deleteManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + in: [COMPANY_1_ID, COMPANY_2_ID], + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + const deleteCompanies = response.body.data.deleteCompanies; + + expect(deleteCompanies).toHaveLength(2); + + deleteCompanies.forEach((company) => { + expect(company.deletedAt).toBeTruthy(); + }); + }); + + it('5b. should delete one company', async () => { + const graphqlOperation = deleteOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + recordId: COMPANY_3_ID, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.deleteCompany.deletedAt).toBeTruthy(); + }); + + it('6. should not find many companies anymore', async () => { + const graphqlOperation = findManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + in: [COMPANY_1_ID, COMPANY_2_ID], + }, + }, + }); + + const findCompaniesResponse = await makeGraphqlAPIRequest(graphqlOperation); + + expect(findCompaniesResponse.body.data.companies.edges).toHaveLength(0); + }); + + it('6b. should not find one company anymore', async () => { + const graphqlOperation = findOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + eq: COMPANY_3_ID, + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.company).toBeNull(); + }); + + it('7. should find many deleted companies with deletedAt filter', async () => { + const graphqlOperation = findManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + in: [COMPANY_1_ID, COMPANY_2_ID], + }, + not: { + deletedAt: { + is: 'NULL', + }, + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.companies.edges).toHaveLength(2); + }); + + it('7b. should find one deleted company with deletedAt filter', async () => { + const graphqlOperation = findOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + eq: COMPANY_3_ID, + }, + not: { + deletedAt: { + is: 'NULL', + }, + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.company.id).toEqual(COMPANY_3_ID); + }); + + it('8. should destroy many companies', async () => { + const graphqlOperation = destroyManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + in: [COMPANY_1_ID, COMPANY_2_ID], + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.destroyCompanies).toHaveLength(2); + }); + + it('8b. should destroy one company', async () => { + const graphqlOperation = destroyOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + recordId: COMPANY_3_ID, + }); + + const destroyCompanyResponse = + await makeGraphqlAPIRequest(graphqlOperation); + + expect(destroyCompanyResponse.body.data.destroyCompany).toBeTruthy(); + }); + + it('9. should not find many companies anymore', async () => { + const graphqlOperation = findManyOperationFactory({ + objectMetadataSingularName: 'company', + objectMetadataPluralName: 'companies', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + in: [COMPANY_1_ID, COMPANY_2_ID], + }, + not: { + deletedAt: { + is: 'NULL', + }, + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.companies.edges).toHaveLength(0); + }); + + it('9b. should not find one company anymore', async () => { + const graphqlOperation = findOneOperationFactory({ + objectMetadataSingularName: 'company', + gqlFields: COMPANY_GQL_FIELDS, + filter: { + id: { + eq: COMPANY_3_ID, + }, + not: { + deletedAt: { + is: 'NULL', + }, + }, + }, + }); + + const response = await makeGraphqlAPIRequest(graphqlOperation); + + expect(response.body.data.company).toBeNull(); + }); +}); diff --git a/packages/twenty-server/test/auth.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/auth.integration-spec.ts similarity index 100% rename from packages/twenty-server/test/auth.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/auth.integration-spec.ts diff --git a/packages/twenty-server/test/activities.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/activities.integration-spec.ts similarity index 97% rename from packages/twenty-server/test/activities.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/activities.integration-spec.ts index 01f262c8f2..0e0134578e 100644 --- a/packages/twenty-server/test/activities.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/activities.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('activitiesResolver (integration)', () => { +describe('activitiesResolver (e2e)', () => { it('should find many activities', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/activity-targets.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/activity-targets.integration-spec.ts similarity index 92% rename from packages/twenty-server/test/activity-targets.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/activity-targets.integration-spec.ts index cbbeb216f0..99b4f0b1e1 100644 --- a/packages/twenty-server/test/activity-targets.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/activity-targets.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('activityTargetsResolver (integration)', () => { +describe('activityTargetsResolver (e2e)', () => { it('should find many activityTargets', () => { const queryData = { query: ` @@ -18,6 +18,7 @@ describe('activityTargetsResolver (integration)', () => { personId companyId opportunityId + rocketId } } } @@ -53,6 +54,7 @@ describe('activityTargetsResolver (integration)', () => { expect(activityTargets).toHaveProperty('personId'); expect(activityTargets).toHaveProperty('companyId'); expect(activityTargets).toHaveProperty('opportunityId'); + expect(activityTargets).toHaveProperty('rocketId'); } }); }); diff --git a/packages/twenty-server/test/api-keys.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/api-keys.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/api-keys.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/api-keys.integration-spec.ts index a196db0861..5515abb9a6 100644 --- a/packages/twenty-server/test/api-keys.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/api-keys.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('apiKeysResolver (integration)', () => { +describe('apiKeysResolver (e2e)', () => { it('should find many apiKeys', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/attachments.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/attachments.integration-spec.ts similarity index 94% rename from packages/twenty-server/test/attachments.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/attachments.integration-spec.ts index 440a6484e6..fc96379633 100644 --- a/packages/twenty-server/test/attachments.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/attachments.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('attachmentsResolver (integration)', () => { +describe('attachmentsResolver (e2e)', () => { it('should find many attachments', () => { const queryData = { query: ` @@ -24,6 +24,7 @@ describe('attachmentsResolver (integration)', () => { personId companyId opportunityId + rocketId } } } @@ -65,6 +66,7 @@ describe('attachmentsResolver (integration)', () => { expect(attachments).toHaveProperty('personId'); expect(attachments).toHaveProperty('companyId'); expect(attachments).toHaveProperty('opportunityId'); + expect(attachments).toHaveProperty('rocketId'); } }); }); diff --git a/packages/twenty-server/test/audit-logs.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/audit-logs.integration-spec.ts similarity index 97% rename from packages/twenty-server/test/audit-logs.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/audit-logs.integration-spec.ts index 99a573235c..77a4507188 100644 --- a/packages/twenty-server/test/audit-logs.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/audit-logs.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('auditLogsResolver (integration)', () => { +describe('auditLogsResolver (e2e)', () => { it('should find many auditLogs', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/blocklists.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/blocklists.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/blocklists.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/blocklists.integration-spec.ts index d8080b3cd5..60da5e4673 100644 --- a/packages/twenty-server/test/blocklists.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/blocklists.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('blocklistsResolver (integration)', () => { +describe('blocklistsResolver (e2e)', () => { it('should find many blocklists', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/calendar-channel-event-associations.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-channel-event-associations.integration-spec.ts similarity index 89% rename from packages/twenty-server/test/calendar-channel-event-associations.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-channel-event-associations.integration-spec.ts index 5d03268b84..023b087691 100644 --- a/packages/twenty-server/test/calendar-channel-event-associations.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-channel-event-associations.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('calendarChannelEventAssociationsResolver (integration)', () => { +describe('calendarChannelEventAssociationsResolver (e2e)', () => { it('should find many calendarChannelEventAssociations', () => { const queryData = { query: ` @@ -11,6 +11,7 @@ describe('calendarChannelEventAssociationsResolver (integration)', () => { edges { node { eventExternalId + recurringEventExternalId id createdAt updatedAt @@ -47,6 +48,9 @@ describe('calendarChannelEventAssociationsResolver (integration)', () => { expect(calendarChannelEventAssociations).toHaveProperty( 'eventExternalId', ); + expect(calendarChannelEventAssociations).toHaveProperty( + 'recurringEventExternalId', + ); expect(calendarChannelEventAssociations).toHaveProperty('id'); expect(calendarChannelEventAssociations).toHaveProperty('createdAt'); expect(calendarChannelEventAssociations).toHaveProperty('updatedAt'); diff --git a/packages/twenty-server/test/calendar-channels.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-channels.integration-spec.ts similarity index 94% rename from packages/twenty-server/test/calendar-channels.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-channels.integration-spec.ts index 6056af6ac6..baab9d5003 100644 --- a/packages/twenty-server/test/calendar-channels.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-channels.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('calendarChannelsResolver (integration)', () => { +describe('calendarChannelsResolver (e2e)', () => { it('should find many calendarChannels', () => { const queryData = { query: ` @@ -18,6 +18,7 @@ describe('calendarChannelsResolver (integration)', () => { contactAutoCreationPolicy isSyncEnabled syncCursor + syncedAt syncStageStartedAt throttleFailureCount id @@ -62,6 +63,7 @@ describe('calendarChannelsResolver (integration)', () => { expect(calendarChannels).toHaveProperty('contactAutoCreationPolicy'); expect(calendarChannels).toHaveProperty('isSyncEnabled'); expect(calendarChannels).toHaveProperty('syncCursor'); + expect(calendarChannels).toHaveProperty('syncedAt'); expect(calendarChannels).toHaveProperty('syncStageStartedAt'); expect(calendarChannels).toHaveProperty('throttleFailureCount'); expect(calendarChannels).toHaveProperty('id'); diff --git a/packages/twenty-server/test/calendar-event-participants.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-event-participants.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/calendar-event-participants.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-event-participants.integration-spec.ts index 50e65547e4..45a8c87a84 100644 --- a/packages/twenty-server/test/calendar-event-participants.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/calendar-event-participants.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('calendarEventParticipantsResolver (integration)', () => { +describe('calendarEventParticipantsResolver (e2e)', () => { it('should find many calendarEventParticipants', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/comments.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/comments.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/comments.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/comments.integration-spec.ts index 0f89ba5491..2508ff628a 100644 --- a/packages/twenty-server/test/comments.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/comments.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('commentsResolver (integration)', () => { +describe('commentsResolver (e2e)', () => { it('should find many comments', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/companies.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/companies.integration-spec.ts similarity index 93% rename from packages/twenty-server/test/companies.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/companies.integration-spec.ts index 63c7f9eec4..1273e624b0 100644 --- a/packages/twenty-server/test/companies.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/companies.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('companiesResolver (integration)', () => { +describe('companiesResolver (e2e)', () => { it('should find many companies', () => { const queryData = { query: ` @@ -14,6 +14,7 @@ describe('companiesResolver (integration)', () => { employees idealCustomerProfile position + searchVector id createdAt updatedAt @@ -53,6 +54,7 @@ describe('companiesResolver (integration)', () => { expect(companies).toHaveProperty('employees'); expect(companies).toHaveProperty('idealCustomerProfile'); expect(companies).toHaveProperty('position'); + expect(companies).toHaveProperty('searchVector'); expect(companies).toHaveProperty('id'); expect(companies).toHaveProperty('createdAt'); expect(companies).toHaveProperty('updatedAt'); diff --git a/packages/twenty-server/test/connected-accounts.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/connected-accounts.integration-spec.ts similarity index 93% rename from packages/twenty-server/test/connected-accounts.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/connected-accounts.integration-spec.ts index e17fd5b285..0a6858940c 100644 --- a/packages/twenty-server/test/connected-accounts.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/connected-accounts.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('connectedAccountsResolver (integration)', () => { +describe('connectedAccountsResolver (e2e)', () => { it('should find many connectedAccounts', () => { const queryData = { query: ` @@ -17,6 +17,7 @@ describe('connectedAccountsResolver (integration)', () => { lastSyncHistoryId authFailedAt handleAliases + scopes id createdAt updatedAt @@ -56,6 +57,7 @@ describe('connectedAccountsResolver (integration)', () => { expect(connectedAccounts).toHaveProperty('lastSyncHistoryId'); expect(connectedAccounts).toHaveProperty('authFailedAt'); expect(connectedAccounts).toHaveProperty('handleAliases'); + expect(connectedAccounts).toHaveProperty('scopes'); expect(connectedAccounts).toHaveProperty('id'); expect(connectedAccounts).toHaveProperty('createdAt'); expect(connectedAccounts).toHaveProperty('updatedAt'); diff --git a/packages/twenty-server/test/favorites.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/favorites.integration-spec.ts similarity index 82% rename from packages/twenty-server/test/favorites.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/favorites.integration-spec.ts index f58e702e55..ea410fabc9 100644 --- a/packages/twenty-server/test/favorites.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/favorites.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('favoritesResolver (integration)', () => { +describe('favoritesResolver (e2e)', () => { it('should find many favorites', () => { const queryData = { query: ` @@ -19,9 +19,13 @@ describe('favoritesResolver (integration)', () => { personId companyId opportunityId + workflowId + workflowVersionId + workflowRunId taskId noteId viewId + rocketId } } } @@ -58,9 +62,13 @@ describe('favoritesResolver (integration)', () => { expect(favorites).toHaveProperty('personId'); expect(favorites).toHaveProperty('companyId'); expect(favorites).toHaveProperty('opportunityId'); + expect(favorites).toHaveProperty('workflowId'); + expect(favorites).toHaveProperty('workflowVersionId'); + expect(favorites).toHaveProperty('workflowRunId'); expect(favorites).toHaveProperty('taskId'); expect(favorites).toHaveProperty('noteId'); expect(favorites).toHaveProperty('viewId'); + expect(favorites).toHaveProperty('rocketId'); } }); }); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/index-metadatas.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/index-metadatas.integration-spec.ts new file mode 100644 index 0000000000..02d3d54b05 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/index-metadatas.integration-spec.ts @@ -0,0 +1,59 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('indexMetadatasResolver (e2e)', () => { + it('should find many indexMetadatas', () => { + const queryData = { + query: ` + query indexMetadatas { + indexMetadatas { + edges { + node { + id + name + isCustom + isUnique + indexWhereClause + indexType + createdAt + updatedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.indexMetadatas; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const indexMetadatas = edges[0].node; + + expect(indexMetadatas).toHaveProperty('id'); + expect(indexMetadatas).toHaveProperty('name'); + expect(indexMetadatas).toHaveProperty('isCustom'); + expect(indexMetadatas).toHaveProperty('isUnique'); + expect(indexMetadatas).toHaveProperty('indexWhereClause'); + expect(indexMetadatas).toHaveProperty('indexType'); + expect(indexMetadatas).toHaveProperty('createdAt'); + expect(indexMetadatas).toHaveProperty('updatedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/message-channel-message-associations.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/message-channel-message-associations.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/message-channel-message-associations.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/message-channel-message-associations.integration-spec.ts index a250550f4b..db17b067bb 100644 --- a/packages/twenty-server/test/message-channel-message-associations.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/message-channel-message-associations.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('messageChannelMessageAssociationsResolver (integration)', () => { +describe('messageChannelMessageAssociationsResolver (e2e)', () => { it('should find many messageChannelMessageAssociations', () => { const queryData = { query: ` @@ -10,11 +10,11 @@ describe('messageChannelMessageAssociationsResolver (integration)', () => { messageChannelMessageAssociations { edges { node { - createdAt messageExternalId messageThreadExternalId direction id + createdAt updatedAt deletedAt messageChannelId @@ -46,7 +46,6 @@ describe('messageChannelMessageAssociationsResolver (integration)', () => { if (edges.length > 0) { const messageChannelMessageAssociations = edges[0].node; - expect(messageChannelMessageAssociations).toHaveProperty('createdAt'); expect(messageChannelMessageAssociations).toHaveProperty( 'messageExternalId', ); @@ -55,6 +54,7 @@ describe('messageChannelMessageAssociationsResolver (integration)', () => { ); expect(messageChannelMessageAssociations).toHaveProperty('direction'); expect(messageChannelMessageAssociations).toHaveProperty('id'); + expect(messageChannelMessageAssociations).toHaveProperty('createdAt'); expect(messageChannelMessageAssociations).toHaveProperty('updatedAt'); expect(messageChannelMessageAssociations).toHaveProperty('deletedAt'); expect(messageChannelMessageAssociations).toHaveProperty( diff --git a/packages/twenty-server/test/message-channels.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/message-channels.integration-spec.ts similarity index 97% rename from packages/twenty-server/test/message-channels.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/message-channels.integration-spec.ts index 8100a885d8..58f9b3ea80 100644 --- a/packages/twenty-server/test/message-channels.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/message-channels.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('messageChannelsResolver (integration)', () => { +describe('messageChannelsResolver (e2e)', () => { it('should find many messageChannels', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/message-participants.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/message-participants.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/message-participants.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/message-participants.integration-spec.ts index 45c190c536..1271455c0c 100644 --- a/packages/twenty-server/test/message-participants.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/message-participants.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('messageParticipantsResolver (integration)', () => { +describe('messageParticipantsResolver (e2e)', () => { it('should find many messageParticipants', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/message-threads.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/message-threads.integration-spec.ts similarity index 95% rename from packages/twenty-server/test/message-threads.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/message-threads.integration-spec.ts index 714bf06bb6..85ec6e2a50 100644 --- a/packages/twenty-server/test/message-threads.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/message-threads.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('messageThreadsResolver (integration)', () => { +describe('messageThreadsResolver (e2e)', () => { it('should find many messageThreads', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/note-targets.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/note-targets.integration-spec.ts similarity index 92% rename from packages/twenty-server/test/note-targets.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/note-targets.integration-spec.ts index 30d309dc32..8cd6b76a34 100644 --- a/packages/twenty-server/test/note-targets.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/note-targets.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('noteTargetsResolver (integration)', () => { +describe('noteTargetsResolver (e2e)', () => { it('should find many noteTargets', () => { const queryData = { query: ` @@ -18,6 +18,7 @@ describe('noteTargetsResolver (integration)', () => { personId companyId opportunityId + rocketId } } } @@ -53,6 +54,7 @@ describe('noteTargetsResolver (integration)', () => { expect(noteTargets).toHaveProperty('personId'); expect(noteTargets).toHaveProperty('companyId'); expect(noteTargets).toHaveProperty('opportunityId'); + expect(noteTargets).toHaveProperty('rocketId'); } }); }); diff --git a/packages/twenty-server/test/notes.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/notes.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/notes.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/notes.integration-spec.ts index eb13fedbac..5f25d3ffa1 100644 --- a/packages/twenty-server/test/notes.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/notes.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('notesResolver (integration)', () => { +describe('notesResolver (e2e)', () => { it('should find many notes', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/objects.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/objects.integration-spec.ts similarity index 97% rename from packages/twenty-server/test/objects.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/objects.integration-spec.ts index 80d1458ab6..afeb568c4c 100644 --- a/packages/twenty-server/test/objects.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/objects.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('objectsResolver (integration)', () => { +describe('objectsResolver (e2e)', () => { it('should find many objects', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/opportunities.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/opportunities.integration-spec.ts similarity index 92% rename from packages/twenty-server/test/opportunities.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/opportunities.integration-spec.ts index 9eebe96a0d..82099405c9 100644 --- a/packages/twenty-server/test/opportunities.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/opportunities.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('opportunitiesResolver (integration)', () => { +describe('opportunitiesResolver (e2e)', () => { it('should find many opportunities', () => { const queryData = { query: ` @@ -14,6 +14,7 @@ describe('opportunitiesResolver (integration)', () => { closeDate stage position + searchVector id createdAt updatedAt @@ -51,6 +52,7 @@ describe('opportunitiesResolver (integration)', () => { expect(opportunities).toHaveProperty('closeDate'); expect(opportunities).toHaveProperty('stage'); expect(opportunities).toHaveProperty('position'); + expect(opportunities).toHaveProperty('searchVector'); expect(opportunities).toHaveProperty('id'); expect(opportunities).toHaveProperty('createdAt'); expect(opportunities).toHaveProperty('updatedAt'); diff --git a/packages/twenty-server/test/people.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/people.integration-spec.ts similarity index 82% rename from packages/twenty-server/test/people.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/people.integration-spec.ts index 28b981e22d..7a8454a12f 100644 --- a/packages/twenty-server/test/people.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/people.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('peopleResolver (integration)', () => { +describe('peopleResolver (e2e)', () => { it('should find many people', () => { const queryData = { query: ` @@ -11,22 +11,16 @@ describe('peopleResolver (integration)', () => { edges { node { jobTitle - phones { - primaryPhoneNumber - primaryPhoneCountryCode - } city avatarUrl position + searchVector id createdAt updatedAt deletedAt companyId intro - whatsapp { - primaryPhoneNumber - } workPreference performanceRating } @@ -42,7 +36,6 @@ describe('peopleResolver (integration)', () => { .send(queryData) .expect(200) .expect((res) => { - console.log(res.body); expect(res.body.data).toBeDefined(); expect(res.body.errors).toBeUndefined(); }) @@ -58,17 +51,16 @@ describe('peopleResolver (integration)', () => { const people = edges[0].node; expect(people).toHaveProperty('jobTitle'); - expect(people).toHaveProperty('phones'); expect(people).toHaveProperty('city'); expect(people).toHaveProperty('avatarUrl'); expect(people).toHaveProperty('position'); + expect(people).toHaveProperty('searchVector'); expect(people).toHaveProperty('id'); expect(people).toHaveProperty('createdAt'); expect(people).toHaveProperty('updatedAt'); expect(people).toHaveProperty('deletedAt'); expect(people).toHaveProperty('companyId'); expect(people).toHaveProperty('intro'); - expect(people).toHaveProperty('whatsapp'); expect(people).toHaveProperty('workPreference'); expect(people).toHaveProperty('performanceRating'); } diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/rockets.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/rockets.integration-spec.ts new file mode 100644 index 0000000000..a9fa0f88f4 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/rockets.integration-spec.ts @@ -0,0 +1,57 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('rocketsResolver (e2e)', () => { + it('should find many rockets', () => { + const queryData = { + query: ` + query rockets { + rockets { + edges { + node { + id + name + createdAt + updatedAt + deletedAt + position + searchVector + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.rockets; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const rockets = edges[0].node; + + expect(rockets).toHaveProperty('id'); + expect(rockets).toHaveProperty('name'); + expect(rockets).toHaveProperty('createdAt'); + expect(rockets).toHaveProperty('updatedAt'); + expect(rockets).toHaveProperty('deletedAt'); + expect(rockets).toHaveProperty('position'); + expect(rockets).toHaveProperty('searchVector'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-activities.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-activities.integration-spec.ts new file mode 100644 index 0000000000..7d9be33624 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-activities.integration-spec.ts @@ -0,0 +1,67 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchActivitiesResolver (e2e)', () => { + it('should find many searchActivities', () => { + const queryData = { + query: ` + query searchActivities { + searchActivities { + edges { + node { + title + body + type + reminderAt + dueAt + completedAt + id + createdAt + updatedAt + deletedAt + authorId + assigneeId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchActivities; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchActivities = edges[0].node; + + expect(searchActivities).toHaveProperty('title'); + expect(searchActivities).toHaveProperty('body'); + expect(searchActivities).toHaveProperty('type'); + expect(searchActivities).toHaveProperty('reminderAt'); + expect(searchActivities).toHaveProperty('dueAt'); + expect(searchActivities).toHaveProperty('completedAt'); + expect(searchActivities).toHaveProperty('id'); + expect(searchActivities).toHaveProperty('createdAt'); + expect(searchActivities).toHaveProperty('updatedAt'); + expect(searchActivities).toHaveProperty('deletedAt'); + expect(searchActivities).toHaveProperty('authorId'); + expect(searchActivities).toHaveProperty('assigneeId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-activity-targets.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-activity-targets.integration-spec.ts new file mode 100644 index 0000000000..64b5fa8c2f --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-activity-targets.integration-spec.ts @@ -0,0 +1,61 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchActivityTargetsResolver (e2e)', () => { + it('should find many searchActivityTargets', () => { + const queryData = { + query: ` + query searchActivityTargets { + searchActivityTargets { + edges { + node { + id + createdAt + updatedAt + deletedAt + activityId + personId + companyId + opportunityId + rocketId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchActivityTargets; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchActivityTargets = edges[0].node; + + expect(searchActivityTargets).toHaveProperty('id'); + expect(searchActivityTargets).toHaveProperty('createdAt'); + expect(searchActivityTargets).toHaveProperty('updatedAt'); + expect(searchActivityTargets).toHaveProperty('deletedAt'); + expect(searchActivityTargets).toHaveProperty('activityId'); + expect(searchActivityTargets).toHaveProperty('personId'); + expect(searchActivityTargets).toHaveProperty('companyId'); + expect(searchActivityTargets).toHaveProperty('opportunityId'); + expect(searchActivityTargets).toHaveProperty('rocketId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-api-keys.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-api-keys.integration-spec.ts new file mode 100644 index 0000000000..6d403e20d2 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-api-keys.integration-spec.ts @@ -0,0 +1,57 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchApiKeysResolver (e2e)', () => { + it('should find many searchApiKeys', () => { + const queryData = { + query: ` + query searchApiKeys { + searchApiKeys { + edges { + node { + name + expiresAt + revokedAt + id + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchApiKeys; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchApiKeys = edges[0].node; + + expect(searchApiKeys).toHaveProperty('name'); + expect(searchApiKeys).toHaveProperty('expiresAt'); + expect(searchApiKeys).toHaveProperty('revokedAt'); + expect(searchApiKeys).toHaveProperty('id'); + expect(searchApiKeys).toHaveProperty('createdAt'); + expect(searchApiKeys).toHaveProperty('updatedAt'); + expect(searchApiKeys).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-attachments.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-attachments.integration-spec.ts new file mode 100644 index 0000000000..1debda9ff4 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-attachments.integration-spec.ts @@ -0,0 +1,73 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchAttachmentsResolver (e2e)', () => { + it('should find many searchAttachments', () => { + const queryData = { + query: ` + query searchAttachments { + searchAttachments { + edges { + node { + name + fullPath + type + id + createdAt + updatedAt + deletedAt + authorId + activityId + taskId + noteId + personId + companyId + opportunityId + rocketId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchAttachments; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchAttachments = edges[0].node; + + expect(searchAttachments).toHaveProperty('name'); + expect(searchAttachments).toHaveProperty('fullPath'); + expect(searchAttachments).toHaveProperty('type'); + expect(searchAttachments).toHaveProperty('id'); + expect(searchAttachments).toHaveProperty('createdAt'); + expect(searchAttachments).toHaveProperty('updatedAt'); + expect(searchAttachments).toHaveProperty('deletedAt'); + expect(searchAttachments).toHaveProperty('authorId'); + expect(searchAttachments).toHaveProperty('activityId'); + expect(searchAttachments).toHaveProperty('taskId'); + expect(searchAttachments).toHaveProperty('noteId'); + expect(searchAttachments).toHaveProperty('personId'); + expect(searchAttachments).toHaveProperty('companyId'); + expect(searchAttachments).toHaveProperty('opportunityId'); + expect(searchAttachments).toHaveProperty('rocketId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-audit-logs.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-audit-logs.integration-spec.ts new file mode 100644 index 0000000000..0a7ecd6f8f --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-audit-logs.integration-spec.ts @@ -0,0 +1,65 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchAuditLogsResolver (e2e)', () => { + it('should find many searchAuditLogs', () => { + const queryData = { + query: ` + query searchAuditLogs { + searchAuditLogs { + edges { + node { + name + properties + context + objectName + objectMetadataId + recordId + id + createdAt + updatedAt + deletedAt + workspaceMemberId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchAuditLogs; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchAuditLogs = edges[0].node; + + expect(searchAuditLogs).toHaveProperty('name'); + expect(searchAuditLogs).toHaveProperty('properties'); + expect(searchAuditLogs).toHaveProperty('context'); + expect(searchAuditLogs).toHaveProperty('objectName'); + expect(searchAuditLogs).toHaveProperty('objectMetadataId'); + expect(searchAuditLogs).toHaveProperty('recordId'); + expect(searchAuditLogs).toHaveProperty('id'); + expect(searchAuditLogs).toHaveProperty('createdAt'); + expect(searchAuditLogs).toHaveProperty('updatedAt'); + expect(searchAuditLogs).toHaveProperty('deletedAt'); + expect(searchAuditLogs).toHaveProperty('workspaceMemberId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-blocklists.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-blocklists.integration-spec.ts new file mode 100644 index 0000000000..f864a62857 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-blocklists.integration-spec.ts @@ -0,0 +1,55 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchBlocklistsResolver (e2e)', () => { + it('should find many searchBlocklists', () => { + const queryData = { + query: ` + query searchBlocklists { + searchBlocklists { + edges { + node { + handle + id + createdAt + updatedAt + deletedAt + workspaceMemberId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchBlocklists; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchBlocklists = edges[0].node; + + expect(searchBlocklists).toHaveProperty('handle'); + expect(searchBlocklists).toHaveProperty('id'); + expect(searchBlocklists).toHaveProperty('createdAt'); + expect(searchBlocklists).toHaveProperty('updatedAt'); + expect(searchBlocklists).toHaveProperty('deletedAt'); + expect(searchBlocklists).toHaveProperty('workspaceMemberId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-channel-event-associations.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-channel-event-associations.integration-spec.ts new file mode 100644 index 0000000000..749ed8c12d --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-channel-event-associations.integration-spec.ts @@ -0,0 +1,73 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchCalendarChannelEventAssociationsResolver (e2e)', () => { + it('should find many searchCalendarChannelEventAssociations', () => { + const queryData = { + query: ` + query searchCalendarChannelEventAssociations { + searchCalendarChannelEventAssociations { + edges { + node { + eventExternalId + recurringEventExternalId + id + createdAt + updatedAt + deletedAt + calendarChannelId + calendarEventId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchCalendarChannelEventAssociations; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchCalendarChannelEventAssociations = edges[0].node; + + expect(searchCalendarChannelEventAssociations).toHaveProperty( + 'eventExternalId', + ); + expect(searchCalendarChannelEventAssociations).toHaveProperty( + 'recurringEventExternalId', + ); + expect(searchCalendarChannelEventAssociations).toHaveProperty('id'); + expect(searchCalendarChannelEventAssociations).toHaveProperty( + 'createdAt', + ); + expect(searchCalendarChannelEventAssociations).toHaveProperty( + 'updatedAt', + ); + expect(searchCalendarChannelEventAssociations).toHaveProperty( + 'deletedAt', + ); + expect(searchCalendarChannelEventAssociations).toHaveProperty( + 'calendarChannelId', + ); + expect(searchCalendarChannelEventAssociations).toHaveProperty( + 'calendarEventId', + ); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-channels.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-channels.integration-spec.ts new file mode 100644 index 0000000000..28196dce80 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-channels.integration-spec.ts @@ -0,0 +1,79 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchCalendarChannelsResolver (e2e)', () => { + it('should find many searchCalendarChannels', () => { + const queryData = { + query: ` + query searchCalendarChannels { + searchCalendarChannels { + edges { + node { + handle + syncStatus + syncStage + visibility + isContactAutoCreationEnabled + contactAutoCreationPolicy + isSyncEnabled + syncCursor + syncedAt + syncStageStartedAt + throttleFailureCount + id + createdAt + updatedAt + deletedAt + connectedAccountId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchCalendarChannels; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchCalendarChannels = edges[0].node; + + expect(searchCalendarChannels).toHaveProperty('handle'); + expect(searchCalendarChannels).toHaveProperty('syncStatus'); + expect(searchCalendarChannels).toHaveProperty('syncStage'); + expect(searchCalendarChannels).toHaveProperty('visibility'); + expect(searchCalendarChannels).toHaveProperty( + 'isContactAutoCreationEnabled', + ); + expect(searchCalendarChannels).toHaveProperty( + 'contactAutoCreationPolicy', + ); + expect(searchCalendarChannels).toHaveProperty('isSyncEnabled'); + expect(searchCalendarChannels).toHaveProperty('syncCursor'); + expect(searchCalendarChannels).toHaveProperty('syncedAt'); + expect(searchCalendarChannels).toHaveProperty('syncStageStartedAt'); + expect(searchCalendarChannels).toHaveProperty('throttleFailureCount'); + expect(searchCalendarChannels).toHaveProperty('id'); + expect(searchCalendarChannels).toHaveProperty('createdAt'); + expect(searchCalendarChannels).toHaveProperty('updatedAt'); + expect(searchCalendarChannels).toHaveProperty('deletedAt'); + expect(searchCalendarChannels).toHaveProperty('connectedAccountId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-event-participants.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-event-participants.integration-spec.ts new file mode 100644 index 0000000000..b72c8aeaa4 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-event-participants.integration-spec.ts @@ -0,0 +1,71 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchCalendarEventParticipantsResolver (e2e)', () => { + it('should find many searchCalendarEventParticipants', () => { + const queryData = { + query: ` + query searchCalendarEventParticipants { + searchCalendarEventParticipants { + edges { + node { + handle + displayName + isOrganizer + responseStatus + id + createdAt + updatedAt + deletedAt + calendarEventId + personId + workspaceMemberId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchCalendarEventParticipants; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchCalendarEventParticipants = edges[0].node; + + expect(searchCalendarEventParticipants).toHaveProperty('handle'); + expect(searchCalendarEventParticipants).toHaveProperty('displayName'); + expect(searchCalendarEventParticipants).toHaveProperty('isOrganizer'); + expect(searchCalendarEventParticipants).toHaveProperty( + 'responseStatus', + ); + expect(searchCalendarEventParticipants).toHaveProperty('id'); + expect(searchCalendarEventParticipants).toHaveProperty('createdAt'); + expect(searchCalendarEventParticipants).toHaveProperty('updatedAt'); + expect(searchCalendarEventParticipants).toHaveProperty('deletedAt'); + expect(searchCalendarEventParticipants).toHaveProperty( + 'calendarEventId', + ); + expect(searchCalendarEventParticipants).toHaveProperty('personId'); + expect(searchCalendarEventParticipants).toHaveProperty( + 'workspaceMemberId', + ); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-events.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-events.integration-spec.ts new file mode 100644 index 0000000000..76ef636a0d --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-calendar-events.integration-spec.ts @@ -0,0 +1,73 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchCalendarEventsResolver (e2e)', () => { + it('should find many searchCalendarEvents', () => { + const queryData = { + query: ` + query searchCalendarEvents { + searchCalendarEvents { + edges { + node { + title + isCanceled + isFullDay + startsAt + endsAt + externalCreatedAt + externalUpdatedAt + description + location + iCalUID + conferenceSolution + id + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchCalendarEvents; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchCalendarEvents = edges[0].node; + + expect(searchCalendarEvents).toHaveProperty('title'); + expect(searchCalendarEvents).toHaveProperty('isCanceled'); + expect(searchCalendarEvents).toHaveProperty('isFullDay'); + expect(searchCalendarEvents).toHaveProperty('startsAt'); + expect(searchCalendarEvents).toHaveProperty('endsAt'); + expect(searchCalendarEvents).toHaveProperty('externalCreatedAt'); + expect(searchCalendarEvents).toHaveProperty('externalUpdatedAt'); + expect(searchCalendarEvents).toHaveProperty('description'); + expect(searchCalendarEvents).toHaveProperty('location'); + expect(searchCalendarEvents).toHaveProperty('iCalUID'); + expect(searchCalendarEvents).toHaveProperty('conferenceSolution'); + expect(searchCalendarEvents).toHaveProperty('id'); + expect(searchCalendarEvents).toHaveProperty('createdAt'); + expect(searchCalendarEvents).toHaveProperty('updatedAt'); + expect(searchCalendarEvents).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-comments.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-comments.integration-spec.ts new file mode 100644 index 0000000000..549f1d3011 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-comments.integration-spec.ts @@ -0,0 +1,57 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchCommentsResolver (e2e)', () => { + it('should find many searchComments', () => { + const queryData = { + query: ` + query searchComments { + searchComments { + edges { + node { + body + id + createdAt + updatedAt + deletedAt + authorId + activityId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchComments; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchComments = edges[0].node; + + expect(searchComments).toHaveProperty('body'); + expect(searchComments).toHaveProperty('id'); + expect(searchComments).toHaveProperty('createdAt'); + expect(searchComments).toHaveProperty('updatedAt'); + expect(searchComments).toHaveProperty('deletedAt'); + expect(searchComments).toHaveProperty('authorId'); + expect(searchComments).toHaveProperty('activityId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-companies.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-companies.integration-spec.ts new file mode 100644 index 0000000000..da309385f7 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-companies.integration-spec.ts @@ -0,0 +1,69 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchCompaniesResolver (e2e)', () => { + it('should find many searchCompanies', () => { + const queryData = { + query: ` + query searchCompanies { + searchCompanies { + edges { + node { + name + employees + idealCustomerProfile + position + searchVector + id + createdAt + updatedAt + deletedAt + accountOwnerId + tagline + workPolicy + visaSponsorship + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchCompanies; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchCompanies = edges[0].node; + + expect(searchCompanies).toHaveProperty('name'); + expect(searchCompanies).toHaveProperty('employees'); + expect(searchCompanies).toHaveProperty('idealCustomerProfile'); + expect(searchCompanies).toHaveProperty('position'); + expect(searchCompanies).toHaveProperty('searchVector'); + expect(searchCompanies).toHaveProperty('id'); + expect(searchCompanies).toHaveProperty('createdAt'); + expect(searchCompanies).toHaveProperty('updatedAt'); + expect(searchCompanies).toHaveProperty('deletedAt'); + expect(searchCompanies).toHaveProperty('accountOwnerId'); + expect(searchCompanies).toHaveProperty('tagline'); + expect(searchCompanies).toHaveProperty('workPolicy'); + expect(searchCompanies).toHaveProperty('visaSponsorship'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-connected-accounts.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-connected-accounts.integration-spec.ts new file mode 100644 index 0000000000..d00c81ecb1 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-connected-accounts.integration-spec.ts @@ -0,0 +1,69 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchConnectedAccountsResolver (e2e)', () => { + it('should find many searchConnectedAccounts', () => { + const queryData = { + query: ` + query searchConnectedAccounts { + searchConnectedAccounts { + edges { + node { + handle + provider + accessToken + refreshToken + lastSyncHistoryId + authFailedAt + handleAliases + scopes + id + createdAt + updatedAt + deletedAt + accountOwnerId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchConnectedAccounts; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchConnectedAccounts = edges[0].node; + + expect(searchConnectedAccounts).toHaveProperty('handle'); + expect(searchConnectedAccounts).toHaveProperty('provider'); + expect(searchConnectedAccounts).toHaveProperty('accessToken'); + expect(searchConnectedAccounts).toHaveProperty('refreshToken'); + expect(searchConnectedAccounts).toHaveProperty('lastSyncHistoryId'); + expect(searchConnectedAccounts).toHaveProperty('authFailedAt'); + expect(searchConnectedAccounts).toHaveProperty('handleAliases'); + expect(searchConnectedAccounts).toHaveProperty('scopes'); + expect(searchConnectedAccounts).toHaveProperty('id'); + expect(searchConnectedAccounts).toHaveProperty('createdAt'); + expect(searchConnectedAccounts).toHaveProperty('updatedAt'); + expect(searchConnectedAccounts).toHaveProperty('deletedAt'); + expect(searchConnectedAccounts).toHaveProperty('accountOwnerId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-favorites.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-favorites.integration-spec.ts new file mode 100644 index 0000000000..982aff7267 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-favorites.integration-spec.ts @@ -0,0 +1,75 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchFavoritesResolver (e2e)', () => { + it('should find many searchFavorites', () => { + const queryData = { + query: ` + query searchFavorites { + searchFavorites { + edges { + node { + position + id + createdAt + updatedAt + deletedAt + workspaceMemberId + personId + companyId + opportunityId + workflowId + workflowVersionId + workflowRunId + taskId + noteId + viewId + rocketId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchFavorites; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchFavorites = edges[0].node; + + expect(searchFavorites).toHaveProperty('position'); + expect(searchFavorites).toHaveProperty('id'); + expect(searchFavorites).toHaveProperty('createdAt'); + expect(searchFavorites).toHaveProperty('updatedAt'); + expect(searchFavorites).toHaveProperty('deletedAt'); + expect(searchFavorites).toHaveProperty('workspaceMemberId'); + expect(searchFavorites).toHaveProperty('personId'); + expect(searchFavorites).toHaveProperty('companyId'); + expect(searchFavorites).toHaveProperty('opportunityId'); + expect(searchFavorites).toHaveProperty('workflowId'); + expect(searchFavorites).toHaveProperty('workflowVersionId'); + expect(searchFavorites).toHaveProperty('workflowRunId'); + expect(searchFavorites).toHaveProperty('taskId'); + expect(searchFavorites).toHaveProperty('noteId'); + expect(searchFavorites).toHaveProperty('viewId'); + expect(searchFavorites).toHaveProperty('rocketId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-channel-message-associations.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-channel-message-associations.integration-spec.ts new file mode 100644 index 0000000000..514b67bb32 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-channel-message-associations.integration-spec.ts @@ -0,0 +1,77 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchMessageChannelMessageAssociationsResolver (e2e)', () => { + it('should find many searchMessageChannelMessageAssociations', () => { + const queryData = { + query: ` + query searchMessageChannelMessageAssociations { + searchMessageChannelMessageAssociations { + edges { + node { + messageExternalId + messageThreadExternalId + direction + id + createdAt + updatedAt + deletedAt + messageChannelId + messageId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchMessageChannelMessageAssociations; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchMessageChannelMessageAssociations = edges[0].node; + + expect(searchMessageChannelMessageAssociations).toHaveProperty( + 'messageExternalId', + ); + expect(searchMessageChannelMessageAssociations).toHaveProperty( + 'messageThreadExternalId', + ); + expect(searchMessageChannelMessageAssociations).toHaveProperty( + 'direction', + ); + expect(searchMessageChannelMessageAssociations).toHaveProperty('id'); + expect(searchMessageChannelMessageAssociations).toHaveProperty( + 'createdAt', + ); + expect(searchMessageChannelMessageAssociations).toHaveProperty( + 'updatedAt', + ); + expect(searchMessageChannelMessageAssociations).toHaveProperty( + 'deletedAt', + ); + expect(searchMessageChannelMessageAssociations).toHaveProperty( + 'messageChannelId', + ); + expect(searchMessageChannelMessageAssociations).toHaveProperty( + 'messageId', + ); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-channels.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-channels.integration-spec.ts new file mode 100644 index 0000000000..c39ccae7c5 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-channels.integration-spec.ts @@ -0,0 +1,87 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchMessageChannelsResolver (e2e)', () => { + it('should find many searchMessageChannels', () => { + const queryData = { + query: ` + query searchMessageChannels { + searchMessageChannels { + edges { + node { + visibility + handle + type + isContactAutoCreationEnabled + contactAutoCreationPolicy + excludeNonProfessionalEmails + excludeGroupEmails + isSyncEnabled + syncCursor + syncedAt + syncStatus + syncStage + syncStageStartedAt + throttleFailureCount + id + createdAt + updatedAt + deletedAt + connectedAccountId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchMessageChannels; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchMessageChannels = edges[0].node; + + expect(searchMessageChannels).toHaveProperty('visibility'); + expect(searchMessageChannels).toHaveProperty('handle'); + expect(searchMessageChannels).toHaveProperty('type'); + expect(searchMessageChannels).toHaveProperty( + 'isContactAutoCreationEnabled', + ); + expect(searchMessageChannels).toHaveProperty( + 'contactAutoCreationPolicy', + ); + expect(searchMessageChannels).toHaveProperty( + 'excludeNonProfessionalEmails', + ); + expect(searchMessageChannels).toHaveProperty('excludeGroupEmails'); + expect(searchMessageChannels).toHaveProperty('isSyncEnabled'); + expect(searchMessageChannels).toHaveProperty('syncCursor'); + expect(searchMessageChannels).toHaveProperty('syncedAt'); + expect(searchMessageChannels).toHaveProperty('syncStatus'); + expect(searchMessageChannels).toHaveProperty('syncStage'); + expect(searchMessageChannels).toHaveProperty('syncStageStartedAt'); + expect(searchMessageChannels).toHaveProperty('throttleFailureCount'); + expect(searchMessageChannels).toHaveProperty('id'); + expect(searchMessageChannels).toHaveProperty('createdAt'); + expect(searchMessageChannels).toHaveProperty('updatedAt'); + expect(searchMessageChannels).toHaveProperty('deletedAt'); + expect(searchMessageChannels).toHaveProperty('connectedAccountId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-participants.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-participants.integration-spec.ts new file mode 100644 index 0000000000..71b9ee4862 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-participants.integration-spec.ts @@ -0,0 +1,63 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchMessageParticipantsResolver (e2e)', () => { + it('should find many searchMessageParticipants', () => { + const queryData = { + query: ` + query searchMessageParticipants { + searchMessageParticipants { + edges { + node { + role + handle + displayName + id + createdAt + updatedAt + deletedAt + messageId + personId + workspaceMemberId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchMessageParticipants; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchMessageParticipants = edges[0].node; + + expect(searchMessageParticipants).toHaveProperty('role'); + expect(searchMessageParticipants).toHaveProperty('handle'); + expect(searchMessageParticipants).toHaveProperty('displayName'); + expect(searchMessageParticipants).toHaveProperty('id'); + expect(searchMessageParticipants).toHaveProperty('createdAt'); + expect(searchMessageParticipants).toHaveProperty('updatedAt'); + expect(searchMessageParticipants).toHaveProperty('deletedAt'); + expect(searchMessageParticipants).toHaveProperty('messageId'); + expect(searchMessageParticipants).toHaveProperty('personId'); + expect(searchMessageParticipants).toHaveProperty('workspaceMemberId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-threads.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-threads.integration-spec.ts new file mode 100644 index 0000000000..5c38ebfeb4 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-message-threads.integration-spec.ts @@ -0,0 +1,51 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchMessageThreadsResolver (e2e)', () => { + it('should find many searchMessageThreads', () => { + const queryData = { + query: ` + query searchMessageThreads { + searchMessageThreads { + edges { + node { + id + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchMessageThreads; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchMessageThreads = edges[0].node; + + expect(searchMessageThreads).toHaveProperty('id'); + expect(searchMessageThreads).toHaveProperty('createdAt'); + expect(searchMessageThreads).toHaveProperty('updatedAt'); + expect(searchMessageThreads).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-messages.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-messages.integration-spec.ts new file mode 100644 index 0000000000..4865fb8d31 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-messages.integration-spec.ts @@ -0,0 +1,61 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchMessagesResolver (e2e)', () => { + it('should find many searchMessages', () => { + const queryData = { + query: ` + query searchMessages { + searchMessages { + edges { + node { + headerMessageId + subject + text + receivedAt + id + createdAt + updatedAt + deletedAt + messageThreadId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchMessages; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchMessages = edges[0].node; + + expect(searchMessages).toHaveProperty('headerMessageId'); + expect(searchMessages).toHaveProperty('subject'); + expect(searchMessages).toHaveProperty('text'); + expect(searchMessages).toHaveProperty('receivedAt'); + expect(searchMessages).toHaveProperty('id'); + expect(searchMessages).toHaveProperty('createdAt'); + expect(searchMessages).toHaveProperty('updatedAt'); + expect(searchMessages).toHaveProperty('deletedAt'); + expect(searchMessages).toHaveProperty('messageThreadId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-note-targets.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-note-targets.integration-spec.ts new file mode 100644 index 0000000000..45188e8aca --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-note-targets.integration-spec.ts @@ -0,0 +1,61 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchNoteTargetsResolver (e2e)', () => { + it('should find many searchNoteTargets', () => { + const queryData = { + query: ` + query searchNoteTargets { + searchNoteTargets { + edges { + node { + id + createdAt + updatedAt + deletedAt + noteId + personId + companyId + opportunityId + rocketId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchNoteTargets; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchNoteTargets = edges[0].node; + + expect(searchNoteTargets).toHaveProperty('id'); + expect(searchNoteTargets).toHaveProperty('createdAt'); + expect(searchNoteTargets).toHaveProperty('updatedAt'); + expect(searchNoteTargets).toHaveProperty('deletedAt'); + expect(searchNoteTargets).toHaveProperty('noteId'); + expect(searchNoteTargets).toHaveProperty('personId'); + expect(searchNoteTargets).toHaveProperty('companyId'); + expect(searchNoteTargets).toHaveProperty('opportunityId'); + expect(searchNoteTargets).toHaveProperty('rocketId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-notes.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-notes.integration-spec.ts new file mode 100644 index 0000000000..8965c5006f --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-notes.integration-spec.ts @@ -0,0 +1,57 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchNotesResolver (e2e)', () => { + it('should find many searchNotes', () => { + const queryData = { + query: ` + query searchNotes { + searchNotes { + edges { + node { + position + title + body + id + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchNotes; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchNotes = edges[0].node; + + expect(searchNotes).toHaveProperty('position'); + expect(searchNotes).toHaveProperty('title'); + expect(searchNotes).toHaveProperty('body'); + expect(searchNotes).toHaveProperty('id'); + expect(searchNotes).toHaveProperty('createdAt'); + expect(searchNotes).toHaveProperty('updatedAt'); + expect(searchNotes).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-opportunities.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-opportunities.integration-spec.ts new file mode 100644 index 0000000000..0f63d73d71 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-opportunities.integration-spec.ts @@ -0,0 +1,65 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchOpportunitiesResolver (e2e)', () => { + it('should find many searchOpportunities', () => { + const queryData = { + query: ` + query searchOpportunities { + searchOpportunities { + edges { + node { + name + closeDate + stage + position + searchVector + id + createdAt + updatedAt + deletedAt + pointOfContactId + companyId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchOpportunities; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchOpportunities = edges[0].node; + + expect(searchOpportunities).toHaveProperty('name'); + expect(searchOpportunities).toHaveProperty('closeDate'); + expect(searchOpportunities).toHaveProperty('stage'); + expect(searchOpportunities).toHaveProperty('position'); + expect(searchOpportunities).toHaveProperty('searchVector'); + expect(searchOpportunities).toHaveProperty('id'); + expect(searchOpportunities).toHaveProperty('createdAt'); + expect(searchOpportunities).toHaveProperty('updatedAt'); + expect(searchOpportunities).toHaveProperty('deletedAt'); + expect(searchOpportunities).toHaveProperty('pointOfContactId'); + expect(searchOpportunities).toHaveProperty('companyId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-people.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-people.integration-spec.ts new file mode 100644 index 0000000000..8c45c0c7e2 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-people.integration-spec.ts @@ -0,0 +1,69 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchPeopleResolver (e2e)', () => { + it('should find many searchPeople', () => { + const queryData = { + query: ` + query searchPeople { + searchPeople { + edges { + node { + jobTitle + city + avatarUrl + position + searchVector + id + createdAt + updatedAt + deletedAt + companyId + intro + workPreference + performanceRating + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchPeople; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchPeople = edges[0].node; + + expect(searchPeople).toHaveProperty('jobTitle'); + expect(searchPeople).toHaveProperty('city'); + expect(searchPeople).toHaveProperty('avatarUrl'); + expect(searchPeople).toHaveProperty('position'); + expect(searchPeople).toHaveProperty('searchVector'); + expect(searchPeople).toHaveProperty('id'); + expect(searchPeople).toHaveProperty('createdAt'); + expect(searchPeople).toHaveProperty('updatedAt'); + expect(searchPeople).toHaveProperty('deletedAt'); + expect(searchPeople).toHaveProperty('companyId'); + expect(searchPeople).toHaveProperty('intro'); + expect(searchPeople).toHaveProperty('workPreference'); + expect(searchPeople).toHaveProperty('performanceRating'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-rockets.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-rockets.integration-spec.ts new file mode 100644 index 0000000000..1bf7385157 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-rockets.integration-spec.ts @@ -0,0 +1,57 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchRocketsResolver (e2e)', () => { + it('should find many searchRockets', () => { + const queryData = { + query: ` + query searchRockets { + searchRockets { + edges { + node { + id + name + createdAt + updatedAt + deletedAt + position + searchVector + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchRockets; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchRockets = edges[0].node; + + expect(searchRockets).toHaveProperty('id'); + expect(searchRockets).toHaveProperty('name'); + expect(searchRockets).toHaveProperty('createdAt'); + expect(searchRockets).toHaveProperty('updatedAt'); + expect(searchRockets).toHaveProperty('deletedAt'); + expect(searchRockets).toHaveProperty('position'); + expect(searchRockets).toHaveProperty('searchVector'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-task-targets.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-task-targets.integration-spec.ts new file mode 100644 index 0000000000..76f9d7b1ec --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-task-targets.integration-spec.ts @@ -0,0 +1,61 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchTaskTargetsResolver (e2e)', () => { + it('should find many searchTaskTargets', () => { + const queryData = { + query: ` + query searchTaskTargets { + searchTaskTargets { + edges { + node { + id + createdAt + updatedAt + deletedAt + taskId + personId + companyId + opportunityId + rocketId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchTaskTargets; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchTaskTargets = edges[0].node; + + expect(searchTaskTargets).toHaveProperty('id'); + expect(searchTaskTargets).toHaveProperty('createdAt'); + expect(searchTaskTargets).toHaveProperty('updatedAt'); + expect(searchTaskTargets).toHaveProperty('deletedAt'); + expect(searchTaskTargets).toHaveProperty('taskId'); + expect(searchTaskTargets).toHaveProperty('personId'); + expect(searchTaskTargets).toHaveProperty('companyId'); + expect(searchTaskTargets).toHaveProperty('opportunityId'); + expect(searchTaskTargets).toHaveProperty('rocketId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-tasks.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-tasks.integration-spec.ts new file mode 100644 index 0000000000..d9af7a1c6a --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-tasks.integration-spec.ts @@ -0,0 +1,63 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchTasksResolver (e2e)', () => { + it('should find many searchTasks', () => { + const queryData = { + query: ` + query searchTasks { + searchTasks { + edges { + node { + position + title + body + dueAt + status + id + createdAt + updatedAt + deletedAt + assigneeId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchTasks; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchTasks = edges[0].node; + + expect(searchTasks).toHaveProperty('position'); + expect(searchTasks).toHaveProperty('title'); + expect(searchTasks).toHaveProperty('body'); + expect(searchTasks).toHaveProperty('dueAt'); + expect(searchTasks).toHaveProperty('status'); + expect(searchTasks).toHaveProperty('id'); + expect(searchTasks).toHaveProperty('createdAt'); + expect(searchTasks).toHaveProperty('updatedAt'); + expect(searchTasks).toHaveProperty('deletedAt'); + expect(searchTasks).toHaveProperty('assigneeId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-timeline-activities.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-timeline-activities.integration-spec.ts new file mode 100644 index 0000000000..b87ec60f1d --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-timeline-activities.integration-spec.ts @@ -0,0 +1,87 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchTimelineActivitiesResolver (e2e)', () => { + it('should find many searchTimelineActivities', () => { + const queryData = { + query: ` + query searchTimelineActivities { + searchTimelineActivities { + edges { + node { + happensAt + name + properties + linkedRecordCachedName + linkedRecordId + linkedObjectMetadataId + id + createdAt + updatedAt + deletedAt + workspaceMemberId + personId + companyId + opportunityId + noteId + taskId + workflowId + workflowVersionId + workflowRunId + rocketId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchTimelineActivities; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchTimelineActivities = edges[0].node; + + expect(searchTimelineActivities).toHaveProperty('happensAt'); + expect(searchTimelineActivities).toHaveProperty('name'); + expect(searchTimelineActivities).toHaveProperty('properties'); + expect(searchTimelineActivities).toHaveProperty( + 'linkedRecordCachedName', + ); + expect(searchTimelineActivities).toHaveProperty('linkedRecordId'); + expect(searchTimelineActivities).toHaveProperty( + 'linkedObjectMetadataId', + ); + expect(searchTimelineActivities).toHaveProperty('id'); + expect(searchTimelineActivities).toHaveProperty('createdAt'); + expect(searchTimelineActivities).toHaveProperty('updatedAt'); + expect(searchTimelineActivities).toHaveProperty('deletedAt'); + expect(searchTimelineActivities).toHaveProperty('workspaceMemberId'); + expect(searchTimelineActivities).toHaveProperty('personId'); + expect(searchTimelineActivities).toHaveProperty('companyId'); + expect(searchTimelineActivities).toHaveProperty('opportunityId'); + expect(searchTimelineActivities).toHaveProperty('noteId'); + expect(searchTimelineActivities).toHaveProperty('taskId'); + expect(searchTimelineActivities).toHaveProperty('workflowId'); + expect(searchTimelineActivities).toHaveProperty('workflowVersionId'); + expect(searchTimelineActivities).toHaveProperty('workflowRunId'); + expect(searchTimelineActivities).toHaveProperty('rocketId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-fields.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-fields.integration-spec.ts new file mode 100644 index 0000000000..b84def1a81 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-fields.integration-spec.ts @@ -0,0 +1,61 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchViewFieldsResolver (e2e)', () => { + it('should find many searchViewFields', () => { + const queryData = { + query: ` + query searchViewFields { + searchViewFields { + edges { + node { + fieldMetadataId + isVisible + size + position + id + createdAt + updatedAt + deletedAt + viewId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchViewFields; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchViewFields = edges[0].node; + + expect(searchViewFields).toHaveProperty('fieldMetadataId'); + expect(searchViewFields).toHaveProperty('isVisible'); + expect(searchViewFields).toHaveProperty('size'); + expect(searchViewFields).toHaveProperty('position'); + expect(searchViewFields).toHaveProperty('id'); + expect(searchViewFields).toHaveProperty('createdAt'); + expect(searchViewFields).toHaveProperty('updatedAt'); + expect(searchViewFields).toHaveProperty('deletedAt'); + expect(searchViewFields).toHaveProperty('viewId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-filters.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-filters.integration-spec.ts new file mode 100644 index 0000000000..fe1e96c4b6 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-filters.integration-spec.ts @@ -0,0 +1,61 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchViewFiltersResolver (e2e)', () => { + it('should find many searchViewFilters', () => { + const queryData = { + query: ` + query searchViewFilters { + searchViewFilters { + edges { + node { + fieldMetadataId + operand + value + displayValue + id + createdAt + updatedAt + deletedAt + viewId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchViewFilters; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchViewFilters = edges[0].node; + + expect(searchViewFilters).toHaveProperty('fieldMetadataId'); + expect(searchViewFilters).toHaveProperty('operand'); + expect(searchViewFilters).toHaveProperty('value'); + expect(searchViewFilters).toHaveProperty('displayValue'); + expect(searchViewFilters).toHaveProperty('id'); + expect(searchViewFilters).toHaveProperty('createdAt'); + expect(searchViewFilters).toHaveProperty('updatedAt'); + expect(searchViewFilters).toHaveProperty('deletedAt'); + expect(searchViewFilters).toHaveProperty('viewId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-sorts.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-sorts.integration-spec.ts new file mode 100644 index 0000000000..7f5b2e6f6a --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-view-sorts.integration-spec.ts @@ -0,0 +1,57 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchViewSortsResolver (e2e)', () => { + it('should find many searchViewSorts', () => { + const queryData = { + query: ` + query searchViewSorts { + searchViewSorts { + edges { + node { + fieldMetadataId + direction + id + createdAt + updatedAt + deletedAt + viewId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchViewSorts; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchViewSorts = edges[0].node; + + expect(searchViewSorts).toHaveProperty('fieldMetadataId'); + expect(searchViewSorts).toHaveProperty('direction'); + expect(searchViewSorts).toHaveProperty('id'); + expect(searchViewSorts).toHaveProperty('createdAt'); + expect(searchViewSorts).toHaveProperty('updatedAt'); + expect(searchViewSorts).toHaveProperty('deletedAt'); + expect(searchViewSorts).toHaveProperty('viewId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-views.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-views.integration-spec.ts new file mode 100644 index 0000000000..716c4a8433 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-views.integration-spec.ts @@ -0,0 +1,67 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchViewsResolver (e2e)', () => { + it('should find many searchViews', () => { + const queryData = { + query: ` + query searchViews { + searchViews { + edges { + node { + name + objectMetadataId + type + key + icon + kanbanFieldMetadataId + position + isCompact + id + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchViews; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchViews = edges[0].node; + + expect(searchViews).toHaveProperty('name'); + expect(searchViews).toHaveProperty('objectMetadataId'); + expect(searchViews).toHaveProperty('type'); + expect(searchViews).toHaveProperty('key'); + expect(searchViews).toHaveProperty('icon'); + expect(searchViews).toHaveProperty('kanbanFieldMetadataId'); + expect(searchViews).toHaveProperty('position'); + expect(searchViews).toHaveProperty('isCompact'); + expect(searchViews).toHaveProperty('id'); + expect(searchViews).toHaveProperty('createdAt'); + expect(searchViews).toHaveProperty('updatedAt'); + expect(searchViews).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-webhooks.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-webhooks.integration-spec.ts new file mode 100644 index 0000000000..d5a93db25e --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-webhooks.integration-spec.ts @@ -0,0 +1,57 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchWebhooksResolver (e2e)', () => { + it('should find many searchWebhooks', () => { + const queryData = { + query: ` + query searchWebhooks { + searchWebhooks { + edges { + node { + id + targetUrl + operation + description + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchWebhooks; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchWebhooks = edges[0].node; + + expect(searchWebhooks).toHaveProperty('id'); + expect(searchWebhooks).toHaveProperty('targetUrl'); + expect(searchWebhooks).toHaveProperty('operation'); + expect(searchWebhooks).toHaveProperty('description'); + expect(searchWebhooks).toHaveProperty('createdAt'); + expect(searchWebhooks).toHaveProperty('updatedAt'); + expect(searchWebhooks).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-event-listeners.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-event-listeners.integration-spec.ts new file mode 100644 index 0000000000..ddf55a1a49 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-event-listeners.integration-spec.ts @@ -0,0 +1,55 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchWorkflowEventListenersResolver (e2e)', () => { + it('should find many searchWorkflowEventListeners', () => { + const queryData = { + query: ` + query searchWorkflowEventListeners { + searchWorkflowEventListeners { + edges { + node { + eventName + id + createdAt + updatedAt + deletedAt + workflowId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchWorkflowEventListeners; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchWorkflowEventListeners = edges[0].node; + + expect(searchWorkflowEventListeners).toHaveProperty('eventName'); + expect(searchWorkflowEventListeners).toHaveProperty('id'); + expect(searchWorkflowEventListeners).toHaveProperty('createdAt'); + expect(searchWorkflowEventListeners).toHaveProperty('updatedAt'); + expect(searchWorkflowEventListeners).toHaveProperty('deletedAt'); + expect(searchWorkflowEventListeners).toHaveProperty('workflowId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-runs.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-runs.integration-spec.ts new file mode 100644 index 0000000000..6307d8ae6b --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-runs.integration-spec.ts @@ -0,0 +1,69 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchWorkflowRunsResolver (e2e)', () => { + it('should find many searchWorkflowRuns', () => { + const queryData = { + query: ` + query searchWorkflowRuns { + searchWorkflowRuns { + edges { + node { + workflowRunId + name + startedAt + endedAt + status + output + position + id + createdAt + updatedAt + deletedAt + workflowVersionId + workflowId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchWorkflowRuns; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchWorkflowRuns = edges[0].node; + + expect(searchWorkflowRuns).toHaveProperty('workflowRunId'); + expect(searchWorkflowRuns).toHaveProperty('name'); + expect(searchWorkflowRuns).toHaveProperty('startedAt'); + expect(searchWorkflowRuns).toHaveProperty('endedAt'); + expect(searchWorkflowRuns).toHaveProperty('status'); + expect(searchWorkflowRuns).toHaveProperty('output'); + expect(searchWorkflowRuns).toHaveProperty('position'); + expect(searchWorkflowRuns).toHaveProperty('id'); + expect(searchWorkflowRuns).toHaveProperty('createdAt'); + expect(searchWorkflowRuns).toHaveProperty('updatedAt'); + expect(searchWorkflowRuns).toHaveProperty('deletedAt'); + expect(searchWorkflowRuns).toHaveProperty('workflowVersionId'); + expect(searchWorkflowRuns).toHaveProperty('workflowId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-versions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-versions.integration-spec.ts new file mode 100644 index 0000000000..86bd6df809 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflow-versions.integration-spec.ts @@ -0,0 +1,63 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchWorkflowVersionsResolver (e2e)', () => { + it('should find many searchWorkflowVersions', () => { + const queryData = { + query: ` + query searchWorkflowVersions { + searchWorkflowVersions { + edges { + node { + name + trigger + steps + status + position + id + createdAt + updatedAt + deletedAt + workflowId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchWorkflowVersions; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchWorkflowVersions = edges[0].node; + + expect(searchWorkflowVersions).toHaveProperty('name'); + expect(searchWorkflowVersions).toHaveProperty('trigger'); + expect(searchWorkflowVersions).toHaveProperty('steps'); + expect(searchWorkflowVersions).toHaveProperty('status'); + expect(searchWorkflowVersions).toHaveProperty('position'); + expect(searchWorkflowVersions).toHaveProperty('id'); + expect(searchWorkflowVersions).toHaveProperty('createdAt'); + expect(searchWorkflowVersions).toHaveProperty('updatedAt'); + expect(searchWorkflowVersions).toHaveProperty('deletedAt'); + expect(searchWorkflowVersions).toHaveProperty('workflowId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflows.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflows.integration-spec.ts new file mode 100644 index 0000000000..b12d780dfe --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workflows.integration-spec.ts @@ -0,0 +1,59 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchWorkflowsResolver (e2e)', () => { + it('should find many searchWorkflows', () => { + const queryData = { + query: ` + query searchWorkflows { + searchWorkflows { + edges { + node { + name + lastPublishedVersionId + statuses + position + id + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchWorkflows; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchWorkflows = edges[0].node; + + expect(searchWorkflows).toHaveProperty('name'); + expect(searchWorkflows).toHaveProperty('lastPublishedVersionId'); + expect(searchWorkflows).toHaveProperty('statuses'); + expect(searchWorkflows).toHaveProperty('position'); + expect(searchWorkflows).toHaveProperty('id'); + expect(searchWorkflows).toHaveProperty('createdAt'); + expect(searchWorkflows).toHaveProperty('updatedAt'); + expect(searchWorkflows).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workspace-members.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workspace-members.integration-spec.ts new file mode 100644 index 0000000000..efc76b4043 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/search-workspace-members.integration-spec.ts @@ -0,0 +1,67 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('searchWorkspaceMembersResolver (e2e)', () => { + it('should find many searchWorkspaceMembers', () => { + const queryData = { + query: ` + query searchWorkspaceMembers { + searchWorkspaceMembers { + edges { + node { + id + colorScheme + avatarUrl + locale + timeZone + dateFormat + timeFormat + userEmail + userId + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.searchWorkspaceMembers; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const searchWorkspaceMembers = edges[0].node; + + expect(searchWorkspaceMembers).toHaveProperty('id'); + expect(searchWorkspaceMembers).toHaveProperty('colorScheme'); + expect(searchWorkspaceMembers).toHaveProperty('avatarUrl'); + expect(searchWorkspaceMembers).toHaveProperty('locale'); + expect(searchWorkspaceMembers).toHaveProperty('timeZone'); + expect(searchWorkspaceMembers).toHaveProperty('dateFormat'); + expect(searchWorkspaceMembers).toHaveProperty('timeFormat'); + expect(searchWorkspaceMembers).toHaveProperty('userEmail'); + expect(searchWorkspaceMembers).toHaveProperty('userId'); + expect(searchWorkspaceMembers).toHaveProperty('createdAt'); + expect(searchWorkspaceMembers).toHaveProperty('updatedAt'); + expect(searchWorkspaceMembers).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/serverless-functions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/serverless-functions.integration-spec.ts new file mode 100644 index 0000000000..9e8d50619e --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/serverless-functions.integration-spec.ts @@ -0,0 +1,59 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('serverlessFunctionsResolver (e2e)', () => { + it('should find many serverlessFunctions', () => { + const queryData = { + query: ` + query serverlessFunctions { + serverlessFunctions { + edges { + node { + id + name + description + runtime + latestVersion + syncStatus + createdAt + updatedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.serverlessFunctions; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const serverlessFunctions = edges[0].node; + + expect(serverlessFunctions).toHaveProperty('id'); + expect(serverlessFunctions).toHaveProperty('name'); + expect(serverlessFunctions).toHaveProperty('description'); + expect(serverlessFunctions).toHaveProperty('runtime'); + expect(serverlessFunctions).toHaveProperty('latestVersion'); + expect(serverlessFunctions).toHaveProperty('syncStatus'); + expect(serverlessFunctions).toHaveProperty('createdAt'); + expect(serverlessFunctions).toHaveProperty('updatedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/task-targets.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/task-targets.integration-spec.ts similarity index 92% rename from packages/twenty-server/test/task-targets.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/task-targets.integration-spec.ts index e54e855d31..b9d5cb4930 100644 --- a/packages/twenty-server/test/task-targets.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/task-targets.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('taskTargetsResolver (integration)', () => { +describe('taskTargetsResolver (e2e)', () => { it('should find many taskTargets', () => { const queryData = { query: ` @@ -18,6 +18,7 @@ describe('taskTargetsResolver (integration)', () => { personId companyId opportunityId + rocketId } } } @@ -53,6 +54,7 @@ describe('taskTargetsResolver (integration)', () => { expect(taskTargets).toHaveProperty('personId'); expect(taskTargets).toHaveProperty('companyId'); expect(taskTargets).toHaveProperty('opportunityId'); + expect(taskTargets).toHaveProperty('rocketId'); } }); }); diff --git a/packages/twenty-server/test/tasks.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/tasks.integration-spec.ts similarity index 97% rename from packages/twenty-server/test/tasks.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/tasks.integration-spec.ts index 900fd3de5c..016341966b 100644 --- a/packages/twenty-server/test/tasks.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/tasks.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('tasksResolver (integration)', () => { +describe('tasksResolver (e2e)', () => { it('should find many tasks', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/timeline-activities.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/timeline-activities.integration-spec.ts similarity index 84% rename from packages/twenty-server/test/timeline-activities.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/timeline-activities.integration-spec.ts index a5ef6a5f96..3e5c72fec0 100644 --- a/packages/twenty-server/test/timeline-activities.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/timeline-activities.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('timelineActivitiesResolver (integration)', () => { +describe('timelineActivitiesResolver (e2e)', () => { it('should find many timelineActivities', () => { const queryData = { query: ` @@ -26,6 +26,10 @@ describe('timelineActivitiesResolver (integration)', () => { opportunityId noteId taskId + workflowId + workflowVersionId + workflowRunId + rocketId } } } @@ -69,6 +73,10 @@ describe('timelineActivitiesResolver (integration)', () => { expect(timelineActivities).toHaveProperty('opportunityId'); expect(timelineActivities).toHaveProperty('noteId'); expect(timelineActivities).toHaveProperty('taskId'); + expect(timelineActivities).toHaveProperty('workflowId'); + expect(timelineActivities).toHaveProperty('workflowVersionId'); + expect(timelineActivities).toHaveProperty('workflowRunId'); + expect(timelineActivities).toHaveProperty('rocketId'); } }); }); diff --git a/packages/twenty-server/test/view-fields.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/view-fields.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/view-fields.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/view-fields.integration-spec.ts index 0585687639..24b28bc5b6 100644 --- a/packages/twenty-server/test/view-fields.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/view-fields.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('viewFieldsResolver (integration)', () => { +describe('viewFieldsResolver (e2e)', () => { it('should find many viewFields', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/view-filters.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/view-filters.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/view-filters.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/view-filters.integration-spec.ts index 8caa942b2b..e76c2f12fd 100644 --- a/packages/twenty-server/test/view-filters.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/view-filters.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('viewFiltersResolver (integration)', () => { +describe('viewFiltersResolver (e2e)', () => { it('should find many viewFilters', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/view-sorts.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/view-sorts.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/view-sorts.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/view-sorts.integration-spec.ts index fc29b1d4c2..850d24cf87 100644 --- a/packages/twenty-server/test/view-sorts.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/view-sorts.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('viewSortsResolver (integration)', () => { +describe('viewSortsResolver (e2e)', () => { it('should find many viewSorts', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/views.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/views.integration-spec.ts similarity index 97% rename from packages/twenty-server/test/views.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/views.integration-spec.ts index 122a8c398f..29cf849985 100644 --- a/packages/twenty-server/test/views.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/views.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('viewsResolver (integration)', () => { +describe('viewsResolver (e2e)', () => { it('should find many views', () => { const queryData = { query: ` @@ -10,13 +10,13 @@ describe('viewsResolver (integration)', () => { views { edges { node { - position name objectMetadataId type key icon kanbanFieldMetadataId + position isCompact id createdAt @@ -49,13 +49,13 @@ describe('viewsResolver (integration)', () => { if (edges.length > 0) { const views = edges[0].node; - expect(views).toHaveProperty('position'); expect(views).toHaveProperty('name'); expect(views).toHaveProperty('objectMetadataId'); expect(views).toHaveProperty('type'); expect(views).toHaveProperty('key'); expect(views).toHaveProperty('icon'); expect(views).toHaveProperty('kanbanFieldMetadataId'); + expect(views).toHaveProperty('position'); expect(views).toHaveProperty('isCompact'); expect(views).toHaveProperty('id'); expect(views).toHaveProperty('createdAt'); diff --git a/packages/twenty-server/test/webhooks.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/webhooks.integration-spec.ts similarity index 96% rename from packages/twenty-server/test/webhooks.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/webhooks.integration-spec.ts index 7c4224b69a..aaf181bf38 100644 --- a/packages/twenty-server/test/webhooks.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/webhooks.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('webhooksResolver (integration)', () => { +describe('webhooksResolver (e2e)', () => { it('should find many webhooks', () => { const queryData = { query: ` @@ -10,10 +10,10 @@ describe('webhooksResolver (integration)', () => { webhooks { edges { node { + id targetUrl operation description - id createdAt updatedAt deletedAt @@ -44,10 +44,10 @@ describe('webhooksResolver (integration)', () => { if (edges.length > 0) { const webhooks = edges[0].node; + expect(webhooks).toHaveProperty('id'); expect(webhooks).toHaveProperty('targetUrl'); expect(webhooks).toHaveProperty('operation'); expect(webhooks).toHaveProperty('description'); - expect(webhooks).toHaveProperty('id'); expect(webhooks).toHaveProperty('createdAt'); expect(webhooks).toHaveProperty('updatedAt'); expect(webhooks).toHaveProperty('deletedAt'); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/workflow-event-listeners.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/workflow-event-listeners.integration-spec.ts new file mode 100644 index 0000000000..6859b52abe --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/workflow-event-listeners.integration-spec.ts @@ -0,0 +1,55 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('workflowEventListenersResolver (e2e)', () => { + it('should find many workflowEventListeners', () => { + const queryData = { + query: ` + query workflowEventListeners { + workflowEventListeners { + edges { + node { + eventName + id + createdAt + updatedAt + deletedAt + workflowId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.workflowEventListeners; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const workflowEventListeners = edges[0].node; + + expect(workflowEventListeners).toHaveProperty('eventName'); + expect(workflowEventListeners).toHaveProperty('id'); + expect(workflowEventListeners).toHaveProperty('createdAt'); + expect(workflowEventListeners).toHaveProperty('updatedAt'); + expect(workflowEventListeners).toHaveProperty('deletedAt'); + expect(workflowEventListeners).toHaveProperty('workflowId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/workflow-versions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/workflow-versions.integration-spec.ts new file mode 100644 index 0000000000..cf3a7d113e --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/workflow-versions.integration-spec.ts @@ -0,0 +1,63 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('workflowVersionsResolver (e2e)', () => { + it('should find many workflowVersions', () => { + const queryData = { + query: ` + query workflowVersions { + workflowVersions { + edges { + node { + name + trigger + steps + status + position + id + createdAt + updatedAt + deletedAt + workflowId + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.workflowVersions; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const workflowVersions = edges[0].node; + + expect(workflowVersions).toHaveProperty('name'); + expect(workflowVersions).toHaveProperty('trigger'); + expect(workflowVersions).toHaveProperty('steps'); + expect(workflowVersions).toHaveProperty('status'); + expect(workflowVersions).toHaveProperty('position'); + expect(workflowVersions).toHaveProperty('id'); + expect(workflowVersions).toHaveProperty('createdAt'); + expect(workflowVersions).toHaveProperty('updatedAt'); + expect(workflowVersions).toHaveProperty('deletedAt'); + expect(workflowVersions).toHaveProperty('workflowId'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/integration/graphql/suites/object-generated/workflows.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/workflows.integration-spec.ts new file mode 100644 index 0000000000..a1c0450f02 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/workflows.integration-spec.ts @@ -0,0 +1,59 @@ +import request from 'supertest'; + +const client = request(`http://localhost:${APP_PORT}`); + +describe('workflowsResolver (e2e)', () => { + it('should find many workflows', () => { + const queryData = { + query: ` + query workflows { + workflows { + edges { + node { + name + lastPublishedVersionId + statuses + position + id + createdAt + updatedAt + deletedAt + } + } + } + } + `, + }; + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send(queryData) + .expect(200) + .expect((res) => { + expect(res.body.data).toBeDefined(); + expect(res.body.errors).toBeUndefined(); + }) + .expect((res) => { + const data = res.body.data.workflows; + + expect(data).toBeDefined(); + expect(Array.isArray(data.edges)).toBe(true); + + const edges = data.edges; + + if (edges.length > 0) { + const workflows = edges[0].node; + + expect(workflows).toHaveProperty('name'); + expect(workflows).toHaveProperty('lastPublishedVersionId'); + expect(workflows).toHaveProperty('statuses'); + expect(workflows).toHaveProperty('position'); + expect(workflows).toHaveProperty('id'); + expect(workflows).toHaveProperty('createdAt'); + expect(workflows).toHaveProperty('updatedAt'); + expect(workflows).toHaveProperty('deletedAt'); + } + }); + }); +}); diff --git a/packages/twenty-server/test/workspace-members.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-generated/workspace-members.integration-spec.ts similarity index 97% rename from packages/twenty-server/test/workspace-members.integration-spec.ts rename to packages/twenty-server/test/integration/graphql/suites/object-generated/workspace-members.integration-spec.ts index 5ef7a415d8..63fd94d81b 100644 --- a/packages/twenty-server/test/workspace-members.integration-spec.ts +++ b/packages/twenty-server/test/integration/graphql/suites/object-generated/workspace-members.integration-spec.ts @@ -2,7 +2,7 @@ import request from 'supertest'; const client = request(`http://localhost:${APP_PORT}`); -describe('workspaceMembersResolver (integration)', () => { +describe('workspaceMembersResolver (e2e)', () => { it('should find many workspaceMembers', () => { const queryData = { query: ` diff --git a/packages/twenty-server/test/integration/graphql/utils/create-many-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/create-many-operation-factory.util.ts new file mode 100644 index 0000000000..70604c0093 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/create-many-operation-factory.util.ts @@ -0,0 +1,28 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type CreateManyOperationFactoryParams = { + objectMetadataSingularName: string; + objectMetadataPluralName: string; + gqlFields: string; + data?: object; +}; + +export const createManyOperationFactory = ({ + objectMetadataSingularName, + objectMetadataPluralName, + gqlFields, + data = {}, +}: CreateManyOperationFactoryParams) => ({ + query: gql` + mutation Create${capitalize(objectMetadataSingularName)}($data: [${capitalize(objectMetadataSingularName)}CreateInput!]!) { + create${capitalize(objectMetadataPluralName)}(data: $data) { + ${gqlFields} + } + } + `, + variables: { + data, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/create-one-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/create-one-operation-factory.util.ts new file mode 100644 index 0000000000..ed477b1a77 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/create-one-operation-factory.util.ts @@ -0,0 +1,26 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type CreateOneOperationFactoryParams = { + objectMetadataSingularName: string; + gqlFields: string; + data?: object; +}; + +export const createOneOperationFactory = ({ + objectMetadataSingularName, + gqlFields, + data = {}, +}: CreateOneOperationFactoryParams) => ({ + query: gql` + mutation Create${capitalize(objectMetadataSingularName)}($data: ${capitalize(objectMetadataSingularName)}CreateInput) { + create${capitalize(objectMetadataSingularName)}(data: $data) { + ${gqlFields} + } + } + `, + variables: { + data, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/delete-many-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/delete-many-operation-factory.util.ts new file mode 100644 index 0000000000..2bfe3c158e --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/delete-many-operation-factory.util.ts @@ -0,0 +1,30 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type DeleteManyOperationFactoryParams = { + objectMetadataSingularName: string; + objectMetadataPluralName: string; + gqlFields: string; + filter?: object; +}; + +export const deleteManyOperationFactory = ({ + objectMetadataSingularName, + objectMetadataPluralName, + gqlFields, + filter = {}, +}: DeleteManyOperationFactoryParams) => ({ + query: gql` + mutation Delete${capitalize(objectMetadataPluralName)}( + $filter: ${capitalize(objectMetadataSingularName)}FilterInput + ) { + delete${capitalize(objectMetadataPluralName)}(filter: $filter) { + ${gqlFields} + } + } + `, + variables: { + filter, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/delete-one-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/delete-one-operation-factory.util.ts new file mode 100644 index 0000000000..f3cfd765b2 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/delete-one-operation-factory.util.ts @@ -0,0 +1,26 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type DeleteOneOperationFactoryParams = { + objectMetadataSingularName: string; + gqlFields: string; + recordId: string; +}; + +export const deleteOneOperationFactory = ({ + objectMetadataSingularName, + gqlFields, + recordId, +}: DeleteOneOperationFactoryParams) => ({ + query: gql` + mutation Delete${capitalize(objectMetadataSingularName)}($${objectMetadataSingularName}Id: ID!) { + delete${capitalize(objectMetadataSingularName)}(id: $${objectMetadataSingularName}Id) { + ${gqlFields} + } + } + `, + variables: { + [`${objectMetadataSingularName}Id`]: recordId, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/destroy-many-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/destroy-many-operation-factory.util.ts new file mode 100644 index 0000000000..f664a40882 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/destroy-many-operation-factory.util.ts @@ -0,0 +1,30 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type DestroyManyOperationFactoryParams = { + objectMetadataSingularName: string; + objectMetadataPluralName: string; + gqlFields: string; + filter?: object; +}; + +export const destroyManyOperationFactory = ({ + objectMetadataSingularName, + objectMetadataPluralName, + gqlFields, + filter = {}, +}: DestroyManyOperationFactoryParams) => ({ + query: gql` + mutation Destroy${capitalize(objectMetadataPluralName)}( + $filter: ${capitalize(objectMetadataSingularName)}FilterInput + ) { + destroy${capitalize(objectMetadataPluralName)}(filter: $filter) { + ${gqlFields} + } + } + `, + variables: { + filter, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/destroy-one-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/destroy-one-operation-factory.util.ts new file mode 100644 index 0000000000..4062e9319f --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/destroy-one-operation-factory.util.ts @@ -0,0 +1,26 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type DestroyOneOperationFactoryParams = { + objectMetadataSingularName: string; + gqlFields: string; + recordId: string; +}; + +export const destroyOneOperationFactory = ({ + objectMetadataSingularName, + gqlFields, + recordId, +}: DestroyOneOperationFactoryParams) => ({ + query: gql` + mutation Destroy${capitalize(objectMetadataSingularName)}($${objectMetadataSingularName}Id: ID!) { + destroy${capitalize(objectMetadataSingularName)}(id: $${objectMetadataSingularName}Id) { + ${gqlFields} + } + } + `, + variables: { + [`${objectMetadataSingularName}Id`]: recordId, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/find-many-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/find-many-operation-factory.util.ts new file mode 100644 index 0000000000..752e9aca0c --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/find-many-operation-factory.util.ts @@ -0,0 +1,32 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type FindManyOperationFactoryParams = { + objectMetadataSingularName: string; + objectMetadataPluralName: string; + gqlFields: string; + filter?: object; +}; + +export const findManyOperationFactory = ({ + objectMetadataSingularName, + objectMetadataPluralName, + gqlFields, + filter = {}, +}: FindManyOperationFactoryParams) => ({ + query: gql` + query ${capitalize(objectMetadataPluralName)}($filter: ${capitalize(objectMetadataSingularName)}FilterInput) { + ${objectMetadataPluralName}(filter: $filter) { + edges { + node { + ${gqlFields} + } + } + } + } + `, + variables: { + filter, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/find-one-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/find-one-operation-factory.util.ts new file mode 100644 index 0000000000..1a6972a841 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/find-one-operation-factory.util.ts @@ -0,0 +1,26 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type FindOneOperationFactoryParams = { + objectMetadataSingularName: string; + gqlFields: string; + filter?: object; +}; + +export const findOneOperationFactory = ({ + objectMetadataSingularName, + gqlFields, + filter = {}, +}: FindOneOperationFactoryParams) => ({ + query: gql` + query ${capitalize(objectMetadataSingularName)}($filter: ${capitalize(objectMetadataSingularName)}FilterInput) { + ${objectMetadataSingularName}(filter: $filter) { + ${gqlFields} + } + } + `, + variables: { + filter, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/make-graphql-api-request.util.ts b/packages/twenty-server/test/integration/graphql/utils/make-graphql-api-request.util.ts new file mode 100644 index 0000000000..21b3e88971 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/make-graphql-api-request.util.ts @@ -0,0 +1,19 @@ +import { ASTNode, print } from 'graphql'; +import request from 'supertest'; + +type GraphqlOperation = { + query: ASTNode; + variables?: Record; +}; + +export const makeGraphqlAPIRequest = (graphqlOperation: GraphqlOperation) => { + const client = request(`http://localhost:${APP_PORT}`); + + return client + .post('/graphql') + .set('Authorization', `Bearer ${ACCESS_TOKEN}`) + .send({ + query: print(graphqlOperation.query), + variables: graphqlOperation.variables || {}, + }); +}; diff --git a/packages/twenty-server/test/integration/graphql/utils/update-many-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/update-many-operation-factory.util.ts new file mode 100644 index 0000000000..688ae91999 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/update-many-operation-factory.util.ts @@ -0,0 +1,34 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type UpdateManyOperationFactoryParams = { + objectMetadataSingularName: string; + objectMetadataPluralName: string; + gqlFields: string; + data?: object; + filter?: object; +}; + +export const updateManyOperationFactory = ({ + objectMetadataSingularName, + objectMetadataPluralName, + gqlFields, + data = {}, + filter = {}, +}: UpdateManyOperationFactoryParams) => ({ + query: gql` + mutation Update${capitalize(objectMetadataPluralName)}( + $data: ${capitalize(objectMetadataSingularName)}UpdateInput + $filter: ${capitalize(objectMetadataSingularName)}FilterInput + ) { + update${capitalize(objectMetadataPluralName)}(data: $data, filter: $filter) { + ${gqlFields} + } + } + `, + variables: { + data, + filter, + }, +}); diff --git a/packages/twenty-server/test/integration/graphql/utils/update-one-operation-factory.util.ts b/packages/twenty-server/test/integration/graphql/utils/update-one-operation-factory.util.ts new file mode 100644 index 0000000000..cf78272412 --- /dev/null +++ b/packages/twenty-server/test/integration/graphql/utils/update-one-operation-factory.util.ts @@ -0,0 +1,29 @@ +import gql from 'graphql-tag'; + +import { capitalize } from 'src/utils/capitalize'; + +type UpdateOneOperationFactoryParams = { + objectMetadataSingularName: string; + gqlFields: string; + data?: object; + recordId: string; +}; + +export const updateOneOperationFactory = ({ + objectMetadataSingularName, + gqlFields, + data = {}, + recordId, +}: UpdateOneOperationFactoryParams) => ({ + query: gql` + mutation Update${capitalize(objectMetadataSingularName)}($${objectMetadataSingularName}Id: ID, $data: ${capitalize(objectMetadataSingularName)}UpdateInput) { + update${capitalize(objectMetadataSingularName)}(id: $${objectMetadataSingularName}Id, data: $data) { + ${gqlFields} + } + } + `, + variables: { + data, + [`${objectMetadataSingularName}Id`]: recordId, + }, +}); diff --git a/packages/twenty-server/test/utils/create-app.ts b/packages/twenty-server/test/integration/utils/create-app.ts similarity index 100% rename from packages/twenty-server/test/utils/create-app.ts rename to packages/twenty-server/test/integration/utils/create-app.ts diff --git a/packages/twenty-server/test/integration/utils/generate-record-name.ts b/packages/twenty-server/test/integration/utils/generate-record-name.ts new file mode 100644 index 0000000000..123de9b6b1 --- /dev/null +++ b/packages/twenty-server/test/integration/utils/generate-record-name.ts @@ -0,0 +1,4 @@ +export const TEST_NAME_PREFIX = 'test_record_'; + +export const generateRecordName = (uuid: string) => + `${TEST_NAME_PREFIX}-${uuid}`; diff --git a/packages/twenty-server/test/utils/setup-test.ts b/packages/twenty-server/test/integration/utils/setup-test.ts similarity index 100% rename from packages/twenty-server/test/utils/setup-test.ts rename to packages/twenty-server/test/integration/utils/setup-test.ts diff --git a/packages/twenty-server/test/utils/teardown-test.ts b/packages/twenty-server/test/integration/utils/teardown-test.ts similarity index 100% rename from packages/twenty-server/test/utils/teardown-test.ts rename to packages/twenty-server/test/integration/utils/teardown-test.ts