Skip to content

Commit

Permalink
fix: Syntax issue in SetupTeamIntegrationE2E mutation (#2587)
Browse files Browse the repository at this point in the history
* fix: Syntax issue in SetupTeamIntegrationE2E mutation

* fix: Account for E2E tests using prod builds

* chore: Tidy up console logs
  • Loading branch information
DafyddLlyr authored Dec 20, 2023
1 parent df91481 commit f356fdf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
15 changes: 4 additions & 11 deletions api.planx.uk/modules/send/bops/bops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/api-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f356fdf

Please sign in to comment.