The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Skip install-apps onboarding step for invited users (#22823)
Raphaël Bosi70e4d8d36e38
diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.spec.ts b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.spec.tsindex 8f7fa9dccff..7dc7b9051bf 100644--- a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.spec.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.spec.ts@@ -32,7 +32,7 @@ const createSignInUpServiceForTests = () => {const mockWorkspaceRepository = {count: jest.fn(),- create: jest.fn(),+ create: jest.fn((workspace) => workspace),};const mockConfigurationValues: MockConfigurationValues = {@@ -50,7 +50,8 @@ const createSignInUpServiceForTests = () => {const queryRunnerMock = {manager: {- save: jest.fn(),+ save: jest.fn((_entity, entity) => entity),+ update: jest.fn(),},connect: jest.fn(),startTransaction: jest.fn(),@@ -101,7 +102,9 @@ const createSignInUpServiceForTests = () => {invalidateAndRecompute: jest.fn(),} as any,{- createWorkspaceCustomApplication: jest.fn(),+ createWorkspaceCustomApplication: jest.fn().mockResolvedValue({+ universalIdentifier: 'custom-application-universal-identifier',+ }),} as any,{uploadWorkspaceLogoFromUrl: jest.fn(),@@ -122,6 +125,9 @@ const createSignInUpServiceForTests = () => {} as any,{createQueryRunner: jest.fn(() => queryRunnerMock),+ transaction: jest.fn(async (runInTransaction) =>+ runInTransaction({ queryRunner: queryRunnerMock }),+ ),} as any,);@@ -349,4 +355,35 @@ describe('SignInUpService onboarding steps', () => {mockOnboardingService.setOnboardingConnectAccountPending,).not.toHaveBeenCalled();});++ it('flags the install-apps step for a user creating a new workspace', async () => {+ const {+ service,+ mockOnboardingService,+ mockWorkspaceRepository,+ mockUserRepository,+ } = createSignInUpServiceForTests();++ mockWorkspaceRepository.count.mockResolvedValue(0);+ mockUserRepository.count.mockResolvedValue(0);++ await service.signUpOnNewWorkspace(+ {+ type: 'newUserWithPicture',+ newUserWithPicture: {+ email: '[email protected]',+ firstName: 'Creator',+ lastName: 'User',+ },+ },+ { displayName: 'Acme Inc' },+ );++ expect(+ mockOnboardingService.setOnboardingInstallAppsPending,+ ).toHaveBeenCalledWith(+ expect.objectContaining({ value: true }),+ expect.anything(),+ );+ });});