Skip to content

Commit

Permalink
fix: Account for E2E tests using prod builds
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Dec 20, 2023
1 parent cc8961b commit 4d06c36
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions api.planx.uk/modules/send/bops/bops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ 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,
);
console.log({ bopsSubmissionURL });
const isSupported = Boolean(bopsSubmissionURL);
if (!isSupported) {
return next(
Expand Down Expand Up @@ -178,21 +180,14 @@ 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,
);
console.log({ bopsSubmissionURL });
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

0 comments on commit 4d06c36

Please sign in to comment.