Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prod] Goal source bugfix, update python, don't roll up goals, create hidden monitoring goal template, store uncovered code report as build artifact #2478

Merged
merged 151 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
aad392e
see what fails
AdamAdHocTeam Oct 18, 2024
9ca1904
add param
AdamAdHocTeam Oct 19, 2024
47576a7
add test
AdamAdHocTeam Oct 21, 2024
94c509c
update e2e for unwind
AdamAdHocTeam Oct 21, 2024
d7cdc42
attempt to fix e2e tests
AdamAdHocTeam Oct 28, 2024
a8259dc
Merge branch 'main' into al-unwind-goals-on-rtr
AdamAdHocTeam Oct 28, 2024
e4057c1
see if this fixes one of the e2e
AdamAdHocTeam Oct 29, 2024
7b4acd9
add tests for wasGoalPreviouslyClosed
nvms Oct 30, 2024
942ade6
add test for extractObjectiveAssociationsFromActivityReportObjectives
nvms Oct 30, 2024
db1e705
coverage for the only uncovered nudge branch
nvms Oct 30, 2024
0179c64
adjust nudge test to correctly cover branch maybe?
nvms Oct 30, 2024
0a38789
see if this fixes e2e
AdamAdHocTeam Oct 30, 2024
fe7a951
fix ar e2e
AdamAdHocTeam Oct 30, 2024
88f4920
see if wait helps
AdamAdHocTeam Oct 31, 2024
54a143e
see if this gets further
AdamAdHocTeam Oct 31, 2024
bf07707
rollback past attempts and increase view port size as sreen was being…
AdamAdHocTeam Oct 31, 2024
b381dd7
in writing tests for findOrFailExistingGoal, maybe fixed a bug
nvms Oct 31, 2024
5c63021
add tests for findOrFailExistingGoal
nvms Oct 31, 2024
35e37c2
add reduceGoals.test
nvms Oct 31, 2024
41c5795
select first goal instead
AdamAdHocTeam Oct 31, 2024
a4ced78
fix lint
AdamAdHocTeam Oct 31, 2024
291354b
add scroll down
AdamAdHocTeam Oct 31, 2024
a302640
set to truthy for now
AdamAdHocTeam Oct 31, 2024
8e0a612
roll back resource change for now as it breaks tests
AdamAdHocTeam Nov 1, 2024
6adff0b
update tess
AdamAdHocTeam Nov 1, 2024
e5ebb0c
Merge branch 'main' into al-unwind-goals-on-rtr
AdamAdHocTeam Nov 1, 2024
6c1989d
switch to truthy
AdamAdHocTeam Nov 1, 2024
9899c7b
changes to similarity to ensure we are rolling up similiar goals by g…
AdamAdHocTeam Nov 1, 2024
3beb5f8
coverage for destroyGoal, hopefully
nvms Nov 4, 2024
47c2699
Merge branch 'main' into jp/3440/goalservices-tests
nvms Nov 4, 2024
11565ec
Distinct is not working as expected, switching to group by
GarrettEHill Nov 4, 2024
836ff2f
make request from the front in parallel
GarrettEHill Nov 4, 2024
12db13b
fix some BE tests
AdamAdHocTeam Nov 5, 2024
42b6e43
scroll for buttons see if it get further
AdamAdHocTeam Nov 5, 2024
45285b5
try scroll into view if needed
AdamAdHocTeam Nov 5, 2024
6fad080
remove code that was added back
AdamAdHocTeam Nov 5, 2024
2e12d8a
re work tests
AdamAdHocTeam Nov 5, 2024
68b3e6e
roll back accidental change
AdamAdHocTeam Nov 5, 2024
0f2a7e5
update e2e for multiple goals
AdamAdHocTeam Nov 5, 2024
c3bc09d
Fix some mailer bugs
thewatermethod Nov 6, 2024
f8c32f4
make sure we dont return any merge suggestions that only contain a si…
AdamAdHocTeam Nov 6, 2024
ce4b87a
increase the simalarity version
AdamAdHocTeam Nov 6, 2024
b56f4d8
Merge pull request #2458 from HHS/TTAHUB-3597/distinct
GarrettEHill Nov 7, 2024
79b7f98
replace reduce with map per Matt
AdamAdHocTeam Nov 8, 2024
0819e06
merge maps
AdamAdHocTeam Nov 8, 2024
3c3d386
add goal template for monitor goal so we have an id
AdamAdHocTeam Nov 8, 2024
e461074
e2e fixes per Jon
AdamAdHocTeam Nov 8, 2024
41e8e8f
add prefix per Garrett
AdamAdHocTeam Nov 8, 2024
c673ac3
Merge pull request #2438 from HHS/jp/3440/goalservices-tests
nvms Nov 8, 2024
2cfe3c4
change goal text per pdf
AdamAdHocTeam Nov 8, 2024
2d181ec
Resolved conflicts in afe8985 by accepting new changes
GarrettEHill Oct 31, 2024
a65196f
lint
GarrettEHill Oct 31, 2024
c806524
more lint
GarrettEHill Oct 31, 2024
4627bbd
move files
GarrettEHill Oct 31, 2024
1cd01a4
typo
GarrettEHill Oct 31, 2024
8098a9b
additional changes needed after script location changed
GarrettEHill Nov 1, 2024
0dff319
markdown-table needs import not require
GarrettEHill Nov 1, 2024
81da396
update to allow execution as a tool
GarrettEHill Nov 1, 2024
959c819
CommonJS module
GarrettEHill Nov 1, 2024
973f82e
Update check-coverage.mjs
GarrettEHill Nov 1, 2024
22c56cd
Update check-coverage.mjs
GarrettEHill Nov 1, 2024
4b3196f
Update config.yml
GarrettEHill Nov 1, 2024
e4705f7
Update check-coverage.mjs
GarrettEHill Nov 5, 2024
496def8
testing no uncovered code
GarrettEHill Nov 5, 2024
f911393
Update ssdi.ts
GarrettEHill Nov 5, 2024
042b0af
Update test-backend-ci
GarrettEHill Nov 5, 2024
8e4e32c
uncovered code test
GarrettEHill Nov 5, 2024
8665e45
Update check-coverage.mjs
GarrettEHill Nov 5, 2024
8f6fa66
make sure the main branch is what is checked and that all diffs are w…
GarrettEHill Nov 5, 2024
73283a4
add coverage check to front end
GarrettEHill Nov 5, 2024
db4e9a0
reformat to ranges
GarrettEHill Nov 5, 2024
9a66c2b
move back to a js file
GarrettEHill Nov 5, 2024
9eea2af
better logging to identify if there are unexpected code paths
GarrettEHill Nov 5, 2024
13f04cb
github ssh
GarrettEHill Nov 5, 2024
dfe1c9f
import to require
GarrettEHill Nov 5, 2024
8eaf743
try loading a different way
GarrettEHill Nov 6, 2024
a89a2b6
frontend needs to have dir added first
GarrettEHill Nov 6, 2024
fea6591
use full path not relative
GarrettEHill Nov 6, 2024
40dee08
more debugging and support for front end checks
GarrettEHill Nov 6, 2024
98ba669
refactor
GarrettEHill Nov 6, 2024
079e3ba
Update config.yml
GarrettEHill Nov 6, 2024
f95201a
Update check-coverage.js
GarrettEHill Nov 6, 2024
90a927c
markdown removed
GarrettEHill Nov 6, 2024
3394b39
more changes to support front end
GarrettEHill Nov 7, 2024
e588586
fix format when not found in coverage
GarrettEHill Nov 7, 2024
fb0e347
adding test coverage for the test coverage checker
GarrettEHill Nov 7, 2024
d6c81c5
Update check-coverage.js
GarrettEHill Nov 7, 2024
620398a
better filtering
GarrettEHill Nov 7, 2024
d6bcb34
filter out non-default path
GarrettEHill Nov 7, 2024
4fdf26a
Update check-coverage.js
GarrettEHill Nov 7, 2024
594c255
Update check-coverage.js
GarrettEHill Nov 7, 2024
800c137
Update check-coverage.js
GarrettEHill Nov 7, 2024
34b3fb3
Update check-coverage.js
GarrettEHill Nov 7, 2024
eed9156
cleanup
GarrettEHill Nov 7, 2024
06ffeeb
run tests on tools
GarrettEHill Nov 8, 2024
a4ea3ff
Update check-coverage.test.js
GarrettEHill Nov 8, 2024
d789550
Update check-coverage.test.js
GarrettEHill Nov 8, 2024
97e5e18
more fixes
GarrettEHill Nov 9, 2024
74af99f
Update check-coverage.test.js
GarrettEHill Nov 9, 2024
346dbba
Update check-coverage.test.js
GarrettEHill Nov 9, 2024
e825902
Update check-coverage.test.js
GarrettEHill Nov 9, 2024
cf3f9a5
fix filters
GarrettEHill Nov 9, 2024
5fddb22
Update config.yml
GarrettEHill Nov 9, 2024
fe1e595
Merge pull request #2462 from HHS/al-ttahub-3513-create-monitor-goal-…
AdamAdHocTeam Nov 10, 2024
c1e4471
Adjust goal source validation
thewatermethod Nov 10, 2024
b5f277a
Select goal source on e2e tests
thewatermethod Nov 10, 2024
c4e0d14
Add log functions
thewatermethod Nov 10, 2024
b7a8b24
Fix "closes a goal" e2e test
thewatermethod Nov 10, 2024
af6b9b4
more test coverage
GarrettEHill Nov 11, 2024
6721497
Update check-coverage.test.js
GarrettEHill Nov 11, 2024
404f51b
Update check-coverage.js
GarrettEHill Nov 11, 2024
175955c
Update check-coverage.js
GarrettEHill Nov 11, 2024
8f8ef6f
always generate the coverage files
GarrettEHill Nov 11, 2024
c995e28
push all communicationDate strings to dd/mm/yyyy format
Nov 12, 2024
c2ceede
tweak comments
Nov 12, 2024
0238705
tweak escaping
Nov 12, 2024
25e77ae
remove test
GarrettEHill Nov 12, 2024
1acb71b
Add regional program director
thewatermethod Nov 12, 2024
a2f6132
add system generated created via
AdamAdHocTeam Nov 12, 2024
6faedd2
also dont check CLI files
GarrettEHill Nov 12, 2024
dfa83a8
Update README.md
GarrettEHill Nov 12, 2024
d735f7e
Merge pull request #2460 from HHS/mb/TTAHUB-3326/fix-some-mailer-bugs
thewatermethod Nov 12, 2024
773de0f
Update README.md
GarrettEHill Nov 12, 2024
92ffef7
Merge pull request #2463 from HHS/TTAHUB-3170/no-new-uncovered-code5
GarrettEHill Nov 12, 2024
87d41d2
rename migrations
AdamAdHocTeam Nov 13, 2024
cb58e30
Recalculate goal source on recipient change
thewatermethod Nov 13, 2024
68c3c8f
Merge branch 'main' into al-unwind-goals-on-rtr
AdamAdHocTeam Nov 13, 2024
f5ed5c8
Update e2e
thewatermethod Nov 13, 2024
a23ae42
Refine change
thewatermethod Nov 13, 2024
b1be5f4
Update python to 3.9.20
thewatermethod Nov 13, 2024
7c7888f
Merge pull request #2475 from HHS/update-python-to-3.9.20
thewatermethod Nov 13, 2024
b7dd61f
Merge branch 'main' into mb/TTAHUB-3581/update-user-role-list-with-re…
thewatermethod Nov 13, 2024
f62003b
Merge branch 'main' into mb/TTAHUB-3611/goal-source-validation
thewatermethod Nov 13, 2024
09d96c2
Revert some e2e changes
thewatermethod Nov 13, 2024
3a26a17
Merge pull request #2419 from HHS/al-unwind-goals-on-rtr
AdamAdHocTeam Nov 13, 2024
aaee2b3
Merge pull request #2473 from HHS/mb/TTAHUB-3581/update-user-role-lis…
thewatermethod Nov 13, 2024
b3634e9
rename migration
AdamAdHocTeam Nov 13, 2024
9e9a5a0
rename again
AdamAdHocTeam Nov 13, 2024
69f15ed
Merge pull request #2464 from HHS/mb/TTAHUB-3611/goal-source-validation
thewatermethod Nov 13, 2024
b9b7160
Merge branch 'main' into al-ttahub-3513-add-system-generated-creation…
AdamAdHocTeam Nov 13, 2024
5fe6d21
Merge pull request #2469 from HHS/al-ttahub-3513-add-system-generated…
AdamAdHocTeam Nov 13, 2024
d086a59
Fix e2e test
thewatermethod Nov 13, 2024
9db95ee
Merge remote-tracking branch 'origin/main' into mb/fix-close-goal-e2e…
thewatermethod Nov 13, 2024
13a2077
Merge pull request #2476 from HHS/mb/fix-close-goal-e2e-test
thewatermethod Nov 13, 2024
dd587fc
remove unneeded date correction logic
Nov 14, 2024
75c459b
add more comments per review and use more legible regex
Nov 14, 2024
8947528
Merge branch 'main' into ttahub-3451/format_comlog_comdate_history
Nov 14, 2024
3018f22
postgres does not exists as a user in deployed envs, causing migratio…
GarrettEHill Nov 14, 2024
67069b1
freshen migration prefix
Nov 14, 2024
0329ad7
Merge pull request #2467 from HHS/ttahub-3451/format_comlog_comdate_h…
hardwarehuman Nov 14, 2024
a6c7c63
Merge pull request #2482 from HHS/TTAHUB-3628/migration-issue
GarrettEHill Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 49 additions & 126 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ executors:
POSTGRES_DB: ttasmarthub
docker-python-executor:
docker:
- image: cimg/python:3.9.19
- image: cimg/python:3.9.20
machine-executor:
machine:
image: ubuntu-2204:current
Expand Down Expand Up @@ -560,10 +560,10 @@ parameters:
type: string
dev_git_branch: # change to feature branch to test deployment
description: "Name of github branch that will deploy to dev"
default: "mb/TTAHUB-3484/insert-standard-goals"
default: "kw-unsafe-inline"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "mb/TTAHUB-3478/goal-nudge-version-2"
default: "mb/TTAHUB-3483/checkbox-to-activity-reports"
type: string
prod_new_relic_app_id:
default: "877570491"
Expand All @@ -580,19 +580,7 @@ parameters:
manual-trigger:
type: boolean
default: false
env_list:
description: "List of environments to manage (start/stop)"
type: string
default: "tta-smarthub-dev,tta-smarthub-sandbox"
space_list:
description: "List of Cloud Foundry spaces corresponding to each environment"
type: string
default: ""
env_state:
description: "State of the environment to change (start, stop, restart, restage)"
type: string
default: "none"
manual-manage-env:
fail-on-modified-lines:
type: boolean
default: false
jobs:
Expand Down Expand Up @@ -695,6 +683,9 @@ jobs:
at: .
- setup_remote_docker:
version: default
- run:
name: Add GitHub to known_hosts
command: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- run:
name: Run migrations ci
command: yarn db:migrate:ci
Expand All @@ -711,6 +702,19 @@ jobs:
command: |
chmod 744 ./bin/test-backend-ci
./bin/test-backend-ci
# Run coverage check script
- run:
name: Check coverage for modified lines
command: |
if [ -n "${CIRCLE_PULL_REQUEST}" ]; then
chmod +x ./tools/check-coverage.js
node -r esm ./tools/check-coverage.js \
--fail-on-uncovered=<< pipeline.parameters.fail-on-modified-lines >> \
--output-format=json,html
else
echo "Not a PR build. Skipping coverage check."
fi
when: always
- run:
name: Compress coverage artifacts
command: tar -cvzf backend-coverage-artifacts.tar coverage/
Expand All @@ -720,6 +724,10 @@ jobs:
path: backend-coverage-artifacts.tar
- store_test_results:
path: reports/
# Store uncovered lines artifact if exists
- store_artifacts:
path: coverage-artifacts/
destination: uncovered-lines
resource_class: large
test_similarity_api:
executor: docker-python-executor
Expand Down Expand Up @@ -775,13 +783,37 @@ jobs:
command: |
chmod 744 ./checkcolorhash.sh
./checkcolorhash.sh;
- run:
name: Add GitHub to known_hosts
command: |
mkdir -p /home/circleci/.ssh
ssh-keyscan -H github.com >> /home/circleci/.ssh/known_hosts

- run:
name: Test frontend
command: yarn --cwd frontend run test:ci --maxWorkers=50%
- run:
name: Check coverage for modified lines
command: |
if [ -n "${CIRCLE_PULL_REQUEST}" ]; then
chmod +x ./tools/check-coverage.js
node -r esm ./tools/check-coverage.js \
--coverage-file=../frontend/coverage/coverage-final.json \
--artifact-dir=../frontend/coverage-artifacts \
--directory-filter=frontend/ \
--fail-on-uncovered=<< pipeline.parameters.fail-on-modified-lines >> \
--output-format=json,html
else
echo "Not a PR build. Skipping coverage check."
fi
when: always
- store_test_results:
path: frontend/reports/
- store_artifacts:
path: frontend/coverage/
- store_artifacts:
path: frontend/coverage-artifacts/
destination: uncovered-lines
resource_class: large
test_e2e:
executor: docker-postgres-executor
Expand Down Expand Up @@ -1264,88 +1296,10 @@ jobs:
rds_service_name: ttahub-prod
s3_service_name: ttahub-db-backups
backup_prefix: production
manage_env_apps:
executor: docker-executor
parameters:
env_list:
type: string
description: "Comma-separated list of environments to manage"
default: "<< pipeline.parameters.env_list >>"
env_state:
type: string
description: "Action to perform on apps (start, stop, restart, restage)"
default: "<< pipeline.parameters.env_state >>"
steps:
- run:
name: Install Cloud Foundry CLI
command: |
curl -v -L -o cf-cli_amd64.deb 'https://packages.cloudfoundry.org/stable?release=debian64&version=v7&source=github'
sudo dpkg -i cf-cli_amd64.deb
- run:
name: Manage Apps
command: |
set -x
env_list="<< parameters.env_list >>"
env_state="<< parameters.env_state >>"

# Split env_list manually
apps=(${env_list//,/ })

for env in "${apps[@]}"; do
# Map full environment name to variable prefixes
if [[ "$env" == "tta-smarthub-sandbox" ]]; then
prefix="SANDBOX"
elif [[ "$env" == "tta-smarthub-dev" ]]; then
prefix="DEV"
else
echo "Unrecognized environment: $env"
exit 1
fi

# Retrieve the environment-specific variables
space_var="CLOUDGOV_${prefix}_SPACE"
username_var="CLOUDGOV_${prefix}_USERNAME"
password_var="CLOUDGOV_${prefix}_PASSWORD"
space="${!space_var}"
username="${!username_var}"
password="${!password_var}"

echo "Logging into space: $space for environment: $env"
cf login \
-a << pipeline.parameters.cg_api >> \
-u "$username" \
-p "$password" \
-o << pipeline.parameters.cg_org >> \
-s "$space"

# Get the current state of the app
state=$(cf app "$env" | grep "state:" | awk '{print $2}')

# Control app state based on env_state parameter
if [[ "$env_state" == "stop" && "$state" != "stopped" ]]; then
echo "Stopping $env..."
cf stop "$env"
elif [[ "$env_state" == "start" && "$state" != "started" ]]; then
echo "Starting $env..."
cf start "$env"
elif [[ "$env_state" == "restart" ]]; then
echo "Restarting $env..."
cf restart "$env"
elif [[ "$env_state" == "restage" ]]; then
echo "Restaging $env..."
cf restage "$env"
else
echo "$env is already in the desired state: $state"
fi
done
workflows:
build_test_deploy:
when:
and:
# Ensure the workflow is only triggered when `manual-trigger` is false
# and `env_state` is empty (i.e., it's not for starting/stopping environments)
- equal: [false, << pipeline.parameters.manual-trigger >>]
- equal: [false, << pipeline.parameters.manual-manage-env >>]
equal: [false, << pipeline.parameters.manual-trigger >>]
jobs:
- build_and_lint
- build_and_lint_similarity_api
Expand Down Expand Up @@ -1453,34 +1407,3 @@ workflows:
equal: [true, << pipeline.parameters.manual-trigger >>]
jobs:
- backup_upload_production
stop_lower_env_workflow:
triggers:
- schedule:
cron: "0 1 * * 2-6" # Runs at 6 PM PST M-F (1 AM UTC next day)
filters:
branches:
only:
- main
jobs:
- manage_env_apps:
env_state: "stop"
env_list: "<< pipeline.parameters.env_list >>"
start_lower_env_workflow:
triggers:
- schedule:
cron: "0 11 * * 1-5" # Runs at 6 AM EST M-F(11 AM UTC)
filters:
branches:
only:
- main
jobs:
- manage_env_apps:
env_state: "start"
env_list: "<< pipeline.parameters.env_list >>"
manual_manage_env_workflow:
when:
equal: [true, << pipeline.parameters.manual-manage-env >>]
jobs:
- manage_env_apps:
env_state: "<< pipeline.parameters.env_state >>"
env_list: "<< pipeline.parameters.env_list >>"
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ On the frontend, the lcov and HTML files are generated as normal, however on the

Another important note for running tests on the backend - we specifically exclude files on the backend that follow the ```*CLI.js``` naming convention (for example, ```adminToolsCLI.js```) from test coverage. This is meant to exclude files intended to be run in the shell. Any functionality in theses files should be imported from a file that is tested. The ```src/tools folder``` is where these files have usually lived and there are lots of great examples of the desired pattern in that folder.

### Coverage reports: Uncovered lines on PR builds

The uncovered lines on PR is generated by finding the intersection between the jest generated coverage file with the git change list for the PR. The additional set of artifacts is generated to aid in providing test coverage for each PR.
* coverage/coverage-final.json - Only on test_backend, all the distinct jest run outputs are consolidated into a unified coverage-final.json file.
* uncovered-lines/uncovered-lines.html - A human readable structure identifing all the lines from this PR that are uncovered by jest tests.
* uncovered-lines/uncovered-lines.json - A json structure identifing all the lines from this PR that are uncovered by jest tests.

This Uncovered lines on PR builds can be configured to fail builds by either perminently changing or overiding the pipeline perameter ```fail-on-modified-lines``` to true, defaults to false.

## Yarn Commands

Expand Down
29 changes: 29 additions & 0 deletions bin/test-backend-ci
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,35 @@ main(){
log "Errors occurred during script execution"
fi

#run tests on tools
node_modules/.bin/cross-env \
JEST_JUNIT_OUTPUT_DIR=reports \
JEST_JUNIT_OUTPUT_NAME="tools".xml \
POSTGRES_USERNAME=postgres \
POSTGRES_DB=ttasmarthub \
CURRENT_USER_ID=5 \
CI=true \
node \
--expose-gc \
./node_modules/.bin/jest \
tools \
--coverage \
--colors \
--reporters=jest-junit \
--reporters=default \
--runInBand \
--silent \
--colors \
--logHeapUsage \
--coverageDirectory="$(pwd)"/coverage/tools \
--collectCoverageFrom="tools/**/!(*CLI).{js,ts}" \
--forceExit

check_exit "$?"

# Merge coverage reports
node ./tools/merge-coverage.js

exit "$exit_code"
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/ExpanderButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function ExpanderButton({
className={`usa-button--outline usa-button text-no-underline text-middle tta-smarthub--expander-row-${type}s tta-smarthub--expander-row-${type}s-enabled`}
onClick={() => closeOrOpen()}
aria-label={`${expanded ? 'Hide' : 'View'} ${ariaLabel}`}
data-testid="expander-button"
>
{expanded ? 'Hide' : 'View'}
{' '}
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/GoalCards/ObjectiveCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function ObjectiveCard({
<ObjectiveStatusDropdown
currentStatus={localStatus}
goalStatus={goalStatus}
objectiveId={objective.id}
objectiveTitle={objective.title}
regionId={regionId}
className="line-height-sans-5"
onUpdateObjectiveStatus={onUpdateObjectiveStatus}
Expand Down Expand Up @@ -192,7 +192,6 @@ function ObjectiveCard({
}

export const objectivePropTypes = PropTypes.shape({
id: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
endDate: PropTypes.string,
reasons: PropTypes.arrayOf(PropTypes.string),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default function ObjectiveStatusDropdown({
onUpdateObjectiveStatus,
regionId,
className,
objectiveId,
goalStatus,
forceReadOnly,
objectiveTitle,
}) {
const { user } = useContext(UserContext);
const [statusOptions, isReadOnly] = useValidObjectiveStatuses(
Expand Down Expand Up @@ -44,7 +44,7 @@ export default function ObjectiveStatusDropdown({

return (
<StatusDropdown
label={`Change status for objective ${objectiveId}`}
label={`Change status for objective ${objectiveTitle}`}
options={options}
className={className}
icon={icon}
Expand All @@ -57,15 +57,16 @@ ObjectiveStatusDropdown.propTypes = {
onUpdateObjectiveStatus: PropTypes.func.isRequired,
goalStatus: PropTypes.string,
currentStatus: PropTypes.string,
objectiveId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
regionId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
className: PropTypes.string,
forceReadOnly: PropTypes.bool,
objectiveTitle: PropTypes.string,
};

ObjectiveStatusDropdown.defaultProps = {
goalStatus: '',
currentStatus: '',
objectiveTitle: '',
className: '',
forceReadOnly: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('ObjectiveStatusDropdown', () => {
onUpdateObjectiveStatus={onUpdate}
forceReadOnly={forceReadOnly}
regionId={1}
objectiveId={345345}
objectiveTitle={345345}
goalStatus="In Progress"
className="test-class"
/>
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/components/GoalForm/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,18 @@ describe('create goal', () => {
const save = await screen.findByRole('button', { name: /save/i });
userEvent.click(save);

const sourceValidation = await screen.findByText('Select a goal source');
expect(sourceValidation).toBeVisible();

await act(async () => {
const source = await screen.findByRole('combobox', { name: /goal source/i });
userEvent.selectOptions(source, 'Federal monitoring issues, including CLASS and RANs');
});

act(() => {
userEvent.click(save);
});

let alert = await screen.findByRole('alert');
expect(alert.textContent).toBe('There was an error saving your goal');

Expand Down
Loading