From b059914e5399a157c8e45eb5b452d6e667b45ee6 Mon Sep 17 00:00:00 2001 From: Rachel Schneiderman Date: Tue, 12 Mar 2024 11:00:18 -0700 Subject: [PATCH] 10007: PR feedback --- cypress/helpers/dynamo/getDynamoCypress.ts | 2 +- cypress/tsconfig.json | 7 ++++++- scripts/dynamo/set-maintenance-mode.ts | 12 ++++++------ scripts/jest-scripts.config.ts | 2 +- web-api/jest-unit.config.ts | 4 ++-- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cypress/helpers/dynamo/getDynamoCypress.ts b/cypress/helpers/dynamo/getDynamoCypress.ts index 6c2dbfb46fd..637e363663a 100644 --- a/cypress/helpers/dynamo/getDynamoCypress.ts +++ b/cypress/helpers/dynamo/getDynamoCypress.ts @@ -5,7 +5,7 @@ import { getCypressEnv } from '../env/cypressEnvironment'; import type { DeleteRequest, PutRequest, -} from '../../../web-api/src/persistence/dynamo/dynamoTypes'; +} from '@web-api/persistence/dynamo/dynamoTypes'; let dynamoCache: DynamoDBClient; let documentCache: DynamoDBDocument; diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index 34083c254c5..70fa74e43d5 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -6,7 +6,12 @@ "noEmit": true, "target": "es5", "lib": ["es5", "dom"], - "types": ["cypress", "node"] + "types": ["cypress", "node"], + "paths": { + "@web-api/*": [ + "../web-api/src/*" + ], + } }, "include": ["**/*.ts"] } diff --git a/scripts/dynamo/set-maintenance-mode.ts b/scripts/dynamo/set-maintenance-mode.ts index 322df8c5d69..013dd15cf4d 100644 --- a/scripts/dynamo/set-maintenance-mode.ts +++ b/scripts/dynamo/set-maintenance-mode.ts @@ -7,16 +7,16 @@ import { InvokeCommand, LambdaClient } from '@aws-sdk/client-lambda'; // # Arguments // # - $1 - true to engage maintenance mode, false to disengage maintenance mode -// # - $2 - the environment to set the flag const args = process.argv.slice(2); const enableMaintenanceMode: boolean = args[0] === 'true'; -const env: string = args[1]; + +const { ENV } = process.env; if (typeof enableMaintenanceMode !== 'boolean') { throw new Error('A value for enable maintenance mode is required.'); } -if (typeof env !== 'string') { +if (typeof ENV !== 'string') { throw new Error('A value for env is required.'); } @@ -29,7 +29,7 @@ async function setMaintenanceMode() { }); const currentColorRecord = await documentClient.get({ Key: { pk: 'current-color', sk: 'current-color' }, - TableName: `efcms-deploy-${env}`, + TableName: `efcms-deploy-${ENV}`, }); const activeColor: 'blue' | 'green' | undefined = currentColorRecord?.Item?.current; @@ -48,11 +48,11 @@ async function setMaintenanceMode() { }); console.log( - `Setting Maintenance mode to ${enableMaintenanceMode} for ${env}`, + `Setting Maintenance mode to ${enableMaintenanceMode} for ${ENV}`, ); const command = new InvokeCommand({ - FunctionName: `send_maintenance_notifications_${env}_${activeColor}`, + FunctionName: `send_maintenance_notifications_${ENV}_${activeColor}`, InvocationType: 'RequestResponse', Payload: Buffer.from( JSON.stringify({ diff --git a/scripts/jest-scripts.config.ts b/scripts/jest-scripts.config.ts index e7a9d525036..a3b21452770 100644 --- a/scripts/jest-scripts.config.ts +++ b/scripts/jest-scripts.config.ts @@ -17,6 +17,7 @@ const config: Config = { '!dynamo/fix-race-condition-served-in-drafts.ts', '!dynamo/read-segment.ts', '!dynamo/set-local-migration-complete-marker.ts', + '!dynamo/set-maintenance-mode.ts', '!elasticsearch/create-temporary-indices.ts', '!elasticsearch/docket-entry-search.ts', '!elasticsearch/docket-inbox.ts', @@ -34,7 +35,6 @@ const config: Config = { '!judge/update-judge-isSeniorJudge.ts', '!reports/**', '!run-once-scripts/**', - '!dynamo/set-maintenance-mode.ts', '!upload-practitioner-application-packages.ts', '!user/**', ], diff --git a/web-api/jest-unit.config.ts b/web-api/jest-unit.config.ts index cb51aa92ff3..8ba54c730d8 100644 --- a/web-api/jest-unit.config.ts +++ b/web-api/jest-unit.config.ts @@ -11,11 +11,11 @@ const config: Config = { 'src/**/*.{js,ts}', 'workflow-terraform/migration/main/lambdas/migrations/*.{js,ts}', '!src/applicationContext.{js,ts}', + '!src/gateways/worker/workerLocal.ts', + '!src/getPersistenceGateway.{js,ts}', '!src/getUseCases.{js,ts}', '!src/getUseCaseHelpers.{js,ts}', - '!src/getPersistenceGateway.{js,ts}', '!src/getUserGateway.ts', - '!src/gateways/worker/workerLocal.ts', '!src/**/*Handlers.{js,ts}', '!src/**/*Lambda.{js,ts}', '!src/app.{js,ts}',