department-of-veterans-affairs / va-mobile-app

"If VA were a company, it would have a flagship mobile app."
https://department-of-veterans-affairs.github.io/va-mobile-app/
17 stars 2 forks source link

CU - Review code coverage report to identify unit testing gaps #10110

Open ATeal opened 2 weeks ago

ATeal commented 2 weeks ago

Proposed Change

Identify files in the codebase with insufficient test coverage by reviewing the coverage report. Create individual tickets for each file with lighter coverage.

Acceptance Criteria

Checklist

timwright12 commented 2 weeks ago

Updated this ticket with AC so it will produce more tickets for related test areas that are discovered in the process. We can then review those tickets for potential good first issues.

alexandec commented 1 week ago

I created a script to parse the json coverage results file, transform the output, apply a coverage threshold, and sort by coverage percentage. Here's the script:

// Report files with coverage % (lines) under threshold, in ascending order.
// Note that
//   coverageReporters: ['json-summary']
// must be present in jest.config.js. Then run "yarn test" to generate
// a json coverage summary for use by this script.

const fs = require('fs')

const coverageReportPath = './coverage/coverage-summary.json'
const threshold = 80

const coverageReport = JSON.parse(fs.readFileSync(coverageReportPath, 'utf8'))

Object.entries(coverageReport)
  .map(([filename, metrics]) => [filename, metrics.lines.pct])
  .filter(([filename, percentage]) => percentage < threshold && filename !== 'total' && !filename.match(/index.tsx?$/))
  .sort((a, b) => a[1] - b[1])
  .forEach(([filename, percentage]) => console.log(`${filename}: ${percentage}%`))
alexandec commented 1 week ago

And here are the results (80% threshold) as of November 2024:

/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/PhotoUpload.tsx: 0%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/homeScreenAlerts.ts: 0%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/rnInAppUpdate.tsx: 0%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/SettingsScreen/DeveloperScreen/OverrideApiScreen.tsx: 18.56%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/SettingsScreen/DeveloperScreen/DeveloperScreen.tsx: 26.57%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/claimsAndAppeals/uploadFileToClaim.tsx: 27.41%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/SharedComponents/DEPRECATED_AppointmentCalendarButton.tsx: 27.77%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/filesystem.ts: 30.76%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/queryClient.ts: 31.57%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/secureMessaging/sendMessage.tsx: 34.14%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/WhatsNew.tsx: 36.04%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/ContactInformationScreen/ContactInformationScreen.tsx: 36.17%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/NotificationManager/NotificationManager.tsx: 36.47%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/rnCalendar.tsx: 37.14%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/SnackBar.tsx: 37.25%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/SettingsScreen/DeveloperScreen/WaygateEditScreen.tsx: 37.28%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/Menu/Menu.tsx: 40%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/prescriptions/requestRefills.tsx: 41.66%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/VeteranStatusScreen/VeteranStatusScreen.tsx: 42.1%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/Appointments/AppointmentTypeComponents/SharedComponents/AppointmentCalendarButton.tsx: 43.93%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/Appointments/UpcomingAppointments/UpcomingAppointmentDetails.tsx: 44.61%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/appointments/cancelAppointment.tsx: 45.45%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/notifications/registerDevice.tsx: 45.65%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/constants/analytics.ts: 46.01%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/contactInformation/saveAddress.tsx: 47.22%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/notifications.tsx: 47.36%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/hooks/auth.tsx: 48.48%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/claimsAndAppeals/getEFolderDocuments.tsx: 50%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/SettingsScreen/DeveloperScreen/RemoteConfigScreen.tsx: 50%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/rnReviews.tsx: 50%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/Appointments/PastAppointments/PastAppointmentDetails.tsx: 50.98%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimLettersScreen/ClaimLettersScreen.tsx: 51.47%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/notifications/updatePushPreferences.tsx: 51.51%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/secureMessaging/downloadFileAttachment.tsx: 52%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/LinkWithAnalytics.tsx: 52.63%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/SecureMessaging/ViewMessage/ViewMessageScreen.tsx: 53.33%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/auth.ts: 53.33%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/inAppReviews.tsx: 54%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/constants/linking.tsx: 54.16%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/prescriptions.tsx: 54.79%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/translations/en/functions.ts: 55.55%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/rnAuthSesson.tsx: 55.55%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/claimsAndAppeals/downloadEFolderDocument.tsx: 56.66%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/decisionLetters/downloadDecisionLetter.tsx: 56.66%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsScreen.tsx: 57.14%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/ClaimFileUpload/TakePhotos/UploadOrAddPhotos/UploadOrAddPhotos.tsx: 57.24%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/claims.tsx: 58.09%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/letters/downloadLetter.tsx: 58.82%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/waygateConfig.ts: 59.01%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/secureMessaging/saveDraft.tsx: 60%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/ClaimFileUpload/SelectFile/SelectFile.tsx: 60%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/store/slices/demoSlice.ts: 60.46%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/ClaimFileUpload/SelectFile/UploadFile/UploadFile.tsx: 61.22%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/store/api/api.ts: 61.65%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/SettingsScreen/NotificationsSettingsScreen/NotificationsSettingsScreen.tsx: 62.79%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/WebviewScreen/WebviewScreen.tsx: 63.44%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/demographics/updateGenderIdentity.tsx: 63.63%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/HealthHelp/HealthHelp.tsx: 63.63%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/Pharmacy/PrescriptionHelp/PrescriptionHelp.tsx: 64.7%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/authorizedServices/getAuthorizedServices.tsx: 65.21%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/CommonErrorComponents/ErrorComponent.tsx: 66%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/contactInformation/deleteEmail.tsx: 66.66%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/LargeNavButton.tsx: 66.66%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/WaygateWrapper.tsx: 66.66%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/contactInformation/deletePhoneNumber.tsx: 68.42%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/auth/LoginScreen/LoginScreen.tsx: 68.53%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/SecureMessaging/EditDraft/EditDraft.tsx: 69.56%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/ContactInformationScreen/EditEmailScreen/EditEmailScreen.tsx: 70.32%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/Letters/LettersOverviewScreen.tsx: 70.45%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/Appointments/UpcomingAppointments/SessionNotStarted.tsx: 71.42%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/remoteConfig.ts: 71.42%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/contactInformation/deleteAddress.tsx: 72.22%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/MessageList.tsx: 72.72%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/errors.ts: 72.72%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/SecureMessaging/ReplyMessage/ReplyMessage.tsx: 73.18%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/Templates/FullScreenSubtask.tsx: 73.46%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/ClickForActionLinkDeprecated.tsx: 73.68%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/PersonalInformationScreen/GenderIdentityScreen/GenderIdentityScreen.tsx: 73.8%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/Pharmacy/RefillScreens/RefillScreen.tsx: 74.25%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/claimsAndAppeals/submitClaimDecision.tsx: 75%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/secureMessaging/deleteMessage.tsx: 75%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/secureMessaging/moveMessage.tsx: 75%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/ClaimFileUpload/AskForClaimDecision/AskForClaimDecision.tsx: 75%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/SecureMessaging/StartNewMessage/StartNewMessage.tsx: 75%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/PersonalInformationScreen/GenderIdentityScreen/WhatToKnowScreen/WhatToKnowScreen.tsx: 75%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/common.ts: 75%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/rnNativeUIUtilities.tsx: 75%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/ContactInformationScreen/EditPhoneNumberScreen/EditPhoneNumberScreen.tsx: 75.22%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimFiles/ClaimFiles.tsx: 75.55%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/VABulletList.tsx: 76.47%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/ClaimFileUpload/SubmitEvidenceSubtask.tsx: 76.92%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/utils/appointments.tsx: 77.16%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/Pharmacy/PrescriptionHistory/PrescriptionHistory.tsx: 77.9%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/SecureMessaging/ViewMessage/CollapsibleMessage.tsx: 78.16%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HomeScreen/ProfileScreen/PersonalInformationScreen/PreferredNameScreen/PreferredNameScreen.tsx: 78.87%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/components/Templates/LargePanel.tsx: 79.41%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/api/directDeposit/updateBankInfo.tsx: 79.59%
/Users/chris/Documents/code/va-mobile-app/VAMobile/src/screens/HealthScreen/SecureMessaging/CancelConfirmations/ComposeCancelConfirmation.tsx: 79.62%