From d7fafc74534e606b76ec5f133a30fa886e8eb97b Mon Sep 17 00:00:00 2001 From: caiodasilva2005 Date: Thu, 19 Sep 2024 22:16:26 -0400 Subject: [PATCH] #2770- assigned test project to team --- src/backend/tests/test-utils.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/tests/test-utils.ts b/src/backend/tests/test-utils.ts index a33678b89f..11a20f82e6 100644 --- a/src/backend/tests/test-utils.ts +++ b/src/backend/tests/test-utils.ts @@ -17,6 +17,7 @@ import { batmanAppAdmin, batmanScheduleSettings, batmanSecureSettings, batmanSet import { getWorkPackageTemplateQueryArgs } from '../src/prisma-query-args/work-package-template.query-args'; import DesignReviewsService from '../src/services/design-reviews.services'; import TasksService from '../src/services/tasks.services'; +import ProjectsService from '../src/services/projects.services'; export interface CreateTestUserParams { firstName: string; @@ -419,7 +420,22 @@ export const createTestDesignReview = async () => { export const createTestTask = async (user: User, organization?: Organization) => { if (!organization) organization = await createTestOrganization(); const orgId = organization.organizationId; - await createTestProject(user, organization.organizationId); + const team = await TeamsService.createTeam(user, 'Test team', user.userId, 'Test', '', false, organization); + if (!team) throw new Error('Failed to create team'); + const project = await createTestProject(user, organization.organizationId); + if (!project) throw new Error('Failed to create project'); + const projectWithTeam = ProjectsService.setProjectTeam( + user, + { + carNumber: 0, + projectNumber: 1, + workPackageNumber: 0 + }, + team.teamId, + organization + ); + if (!projectWithTeam) throw new Error('Failed to create project with team'); + const task = await TasksService.createTask( user, {