From f356fdffe3f743faaa72f1b026ef4e5ee92e8364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Wed, 20 Dec 2023 13:44:15 +0000 Subject: [PATCH] fix: Syntax issue in `SetupTeamIntegrationE2E` mutation (#2587) * fix: Syntax issue in SetupTeamIntegrationE2E mutation * fix: Account for E2E tests using prod builds * chore: Tidy up console logs --- api.planx.uk/modules/send/bops/bops.ts | 15 ++++----------- e2e/tests/api-driven/src/invite-to-pay/helpers.ts | 8 ++++---- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/api.planx.uk/modules/send/bops/bops.ts b/api.planx.uk/modules/send/bops/bops.ts index 22e4568a11..9bfed5c288 100644 --- a/api.planx.uk/modules/send/bops/bops.ts +++ b/api.planx.uk/modules/send/bops/bops.ts @@ -44,7 +44,8 @@ const sendToBOPS = async (req: Request, res: Response, next: NextFunction) => { // a local or staging API instance should send to the BOPS staging endpoint // production should send to the BOPS production endpoint const localAuthority = req.params.localAuthority; - const env = process.env.NODE_ENV === "production" ? "production" : "staging"; + const env = + process.env.APP_ENVIRONMENT === "production" ? "production" : "staging"; const bopsSubmissionURL = await $api.team.getBopsSubmissionURL( localAuthority, env, @@ -178,21 +179,13 @@ const sendToBOPSV2 = async ( // a local or staging API instance should send to the BOPS staging endpoint // production should send to the BOPS production endpoint const localAuthority = req.params.localAuthority; - const env = process.env.NODE_ENV === "production" ? "production" : "staging"; + const env = + process.env.APP_ENVIRONMENT === "production" ? "production" : "staging"; const bopsSubmissionURL = await $api.team.getBopsSubmissionURL( localAuthority, env, ); const isSupported = Boolean(bopsSubmissionURL); - if (!isSupported) { - return next( - new ServerError({ - status: 400, - message: `Back-office Planning System (BOPS) is not enabled for this local authority (${localAuthority})`, - }), - ); - } - if (!isSupported) { return next( new ServerError({ diff --git a/e2e/tests/api-driven/src/invite-to-pay/helpers.ts b/e2e/tests/api-driven/src/invite-to-pay/helpers.ts index e736da0b39..ca777943b9 100644 --- a/e2e/tests/api-driven/src/invite-to-pay/helpers.ts +++ b/e2e/tests/api-driven/src/invite-to-pay/helpers.ts @@ -164,13 +164,13 @@ const setupMockBopsSubmissionUrl = async (teamId: number) => { await $admin.client.request( gql` mutation SetupTeamIntegrationE2E( - $staging_bops_submission_url: String - $team_id: Int + $stagingBopsSubmissionUrl: String + $teamId: Int ) { insert_team_integrations_one( object: { - teamId: $team_id - stagingBopsSubmissionUrl: $staging_bops_submission_url + team_id: $teamId + staging_bops_submission_url: $stagingBopsSubmissionUrl } ) { id