good for first time contributor: extend donor portal unit test coverage
Closed, ResolvedPublic

Description

PASS tests/jest/views/cancel-donations.test.js
----------------------------------------------------|---------|----------|---------|---------|-----------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------------------------------------------------|---------|----------|---------|---------|-----------------------
All files | 94.34 | 85.6 | 88.02 | 94.31 |
ext.donationInterface.donorPortal | 77.38 | 63.63 | 86.66 | 77.38 |

ApiUtils.js                                       |   93.75 |       50 |     100 |   93.75 | 41                    
normalizeInput.js                                 |   63.88 |    59.45 |      75 |   63.88 | 4,21,32-35,54-66      
router.js                                         |   80.76 |    71.42 |      50 |   80.76 | 13-14,20-21,54        
trackingParams.js                                 |     100 |      100 |     100 |     100 |

ext.donationInterface.donorPortal/components | 95.14 | 90.76 | 84.77 | 95.14 |

App.vue                                           |     100 |      100 |     100 |     100 |                       
DonationsDisclaimerComponent.vue                  |     100 |      100 |     100 |     100 |                       
DonationsHistory.vue                              |   94.44 |      100 |      75 |   94.44 | 16-23                 
DonationsListTable.vue                            |   89.28 |    94.44 |   73.33 |   89.28 | 23,40,137-153,183-199 
DonorCardComponent.vue                            |     100 |       90 |     100 |     100 | 78                    
DonorContactDetails.vue                           |   93.93 |    86.36 |     100 |   93.93 | 46,48                 
EndowmentInformationComponent.vue                 |     100 |      100 |     100 |     100 |                       
ErrorComponent.vue                                |     100 |      100 |     100 |     100 |                       
FeedbackSurveyComponent.vue                       |     100 |      100 |     100 |     100 |                       
GreetingComponent.vue                             |     100 |      100 |     100 |     100 |                       
Header.vue                                        |   87.17 |    88.23 |   66.66 |   87.17 | 30-37,134             
OnetimeContribution.vue                           |     100 |      100 |     100 |     100 |                       
PopupLink.vue                                     |     100 |      100 |     100 |     100 |                       
RadioButtonInput.vue                              |   94.44 |      100 |      75 |   94.44 | 63                    
RecurringContributionAnnualConversionForm.vue     |   93.02 |    78.04 |      70 |   93.02 | 19,50,217-245,262     
RecurringContributionAnnualConversionSuccess.vue  |      96 |      100 |   83.33 |      96 | 17                    
RecurringContributionCancelAltOptionContainer.vue |     100 |      100 |   83.33 |     100 |                       
RecurringContributionCancelConfirmation.vue       |   97.22 |       90 |      90 |   97.22 | 22                    
RecurringContributionCancelForm.vue               |   94.23 |    91.66 |   85.71 |   94.23 | 24,52,55              
RecurringContributionCancelSuccess.vue            |   96.42 |       50 |     100 |   96.42 | 28                    
RecurringContributionComponent.vue                |   89.55 |    89.65 |   88.88 |   89.55 | 42-45,51,56,182       
RecurringContributionPauseForm.vue                |   97.14 |      100 |    87.5 |   97.14 | 22                    
RecurringContributionPauseSuccess.vue             |   94.44 |      100 |      75 |   94.44 | 17                    
RecurringContributionSummary.vue                  |     100 |      100 |     100 |     100 |                       
RecurringContributionUpdateForm.vue               |   96.72 |    89.18 |   83.33 |   96.72 | 85,183                
RecurringContributionUpdateSuccess.vue            |     100 |      100 |     100 |     100 |                       
RelatedContentComponent.vue                       |   94.11 |      100 |      60 |   94.11 | 102-108

ext.donationInterface.donorPortal/views | 96.31 | 81.66 | 97.22 | 96.25 |

AmountDowngrade.vue                               |   97.61 |       70 |     100 |   97.56 | 31                    
AnnualConversion.vue                              |    97.5 |       70 |     100 |   97.43 | 32                    
CancelDonations.vue                               |   98.38 |    77.77 |     100 |   98.36 | 35                    
Home.vue                                          |   96.77 |       90 |     100 |   96.77 | 38                    
LoginView.vue                                     |      90 |    89.47 |   90.47 |      90 | 36-38,60-62,94,207    
ManageDonations.vue                               |   98.07 |    91.66 |     100 |   98.03 | 21                    
PauseDonations.vue                                |   97.61 |       70 |     100 |   97.56 | 29                    
UpdateDonations.vue                               |   97.56 |       75 |     100 |    97.5 | 30

----------------------------------------------------|---------|----------|---------|---------|-----------------------

Test Suites: 29 passed, 29 total
Tests: 98 passed, 98 total
Snapshots: 0 total
Time: 2.559 s
Ran all test suites.

Details

Related Changes in Gerrit:
SubjectAuthorRepoBranchLines +/-
Dmirandamediawiki/extensions/DonationInterfacemaster+55 -11
Dmirandamediawiki/extensions/DonationInterfacemaster+21 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+83 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+45 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+45 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+21 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+70 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+68 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+54 -2
Dmirandamediawiki/extensions/DonationInterfacemaster+28 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+67 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+82 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+65 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+46 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+46 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+56 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+144 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+76 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+45 -0
Dmirandamediawiki/extensions/DonationInterfacemaster+67 -1
Dmirandamediawiki/extensions/DonationInterfacemaster+10 -0
Show related patches Customize query in gerrit

Event Timeline

AnnWF renamed this task from extend donor portal unit test coverage to good for first time contributor: extend donor portal unit test coverage.Jun 17 2026, 5:24 PM

go to local src/email-pref-ctr/extensions/DonationInterface
run npm install
then run npm run test
you will find the info as ticket
try to make 100% unit test coverage

this would help for fast on board what we did in donor portal and how to write vue js, which would be used for combo wiki too

Change #1310692 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] added tests for APIUtils and normalizeInput

https://gerrit.wikimedia.org/r/1310692

Change #1310693 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated router.js to 100% coverage

https://gerrit.wikimedia.org/r/1310693

Change #1310700 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated donations_history test with a case testing the default value

https://gerrit.wikimedia.org/r/1310700

Change #1311140 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated donations list table tests

https://gerrit.wikimedia.org/r/1311140

Change #1311534 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Created test file for DonorCardComponent. Also updated an v-else statement that was creating a non-testable case.

https://gerrit.wikimedia.org/r/1311534

Change #1310700 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated donations_history test with a case testing the default value

https://gerrit.wikimedia.org/r/1310700

Change #1311534 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Created test file for DonorCardComponent. Also updated an v-else statement that was creating a non-testable case.

https://gerrit.wikimedia.org/r/1311534

Change #1311581 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated contact_details.test.js to 100% coverage

https://gerrit.wikimedia.org/r/1311581

Change #1311581 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated contact_details.test.js to 100% coverage

https://gerrit.wikimedia.org/r/1311581

Change #1311140 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated donations list table tests

https://gerrit.wikimedia.org/r/1311140

Change #1310692 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] added tests for APIUtils and normalizeInput

https://gerrit.wikimedia.org/r/1310692

Change #1312636 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] WIP: Updated header.test.js to 100% coverage.

https://gerrit.wikimedia.org/r/1312636

Change #1312655 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Added new test file for radio button input, got test coverage to 100%

https://gerrit.wikimedia.org/r/1312655

Change #1313269 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Cover the hidden switch to annual link in cancel confirmation

https://gerrit.wikimedia.org/r/1313269

Change #1312655 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Added new test file for radio button input, got test coverage to 100%

https://gerrit.wikimedia.org/r/1312655

Change #1314130 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated recurring_contribution.test.js to as close as 100% as currently possible

https://gerrit.wikimedia.org/r/1314130

Change #1314138 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated recurring-update-form.test.js to 100% test coverage

https://gerrit.wikimedia.org/r/1314138

Change #1314158 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Added test file for Donor Portal's related content component. Test coverage now at 100%.

https://gerrit.wikimedia.org/r/1314158

Change #1314553 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated AmountDowngrade.vue to 100% test coverage.

https://gerrit.wikimedia.org/r/1314553

Change #1314569 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated AnnualConversion.vue to 100% test coverage.

https://gerrit.wikimedia.org/r/1314569

Change #1314569 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated AnnualConversion.vue to 100% test coverage.

https://gerrit.wikimedia.org/r/1314569

Change #1314553 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated AmountDowngrade.vue to 100% test coverage.

https://gerrit.wikimedia.org/r/1314553

Change #1314158 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Added test file for Donor Portal's related content component. Test coverage now at 100%.

https://gerrit.wikimedia.org/r/1314158

Change #1314130 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated recurring_contribution.test.js to as close as 100% as currently possible

https://gerrit.wikimedia.org/r/1314130

Change #1315205 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Update manage-donations.test.js to 100% test coverage

https://gerrit.wikimedia.org/r/1315205

Change #1315225 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated pause-donations.test.js to almost full test coverage.

https://gerrit.wikimedia.org/r/1315225

Change #1315235 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Cover not-found and unknown-error branches in UpdateDonations view.

https://gerrit.wikimedia.org/r/1315235

Change #1315262 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated home.test.js to 100% test coverage.

https://gerrit.wikimedia.org/r/1315262

Change #1315551 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated RecurringContributionCancelAltOptionContainer to 100% test coverage

https://gerrit.wikimedia.org/r/1315551

Change #1315551 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated RecurringContributionCancelAltOptionContainer to 100% test coverage

https://gerrit.wikimedia.org/r/1315551

Change #1315262 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated home.test.js to 100% test coverage.

https://gerrit.wikimedia.org/r/1315262

Change #1316096 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Update cancel-donations.test.js to almost full test coverage.

https://gerrit.wikimedia.org/r/1316096

Change #1316138 had a related patch set uploaded (by Dmiranda; author: Dmiranda):

[mediawiki/extensions/DonationInterface@master] Updated login.test.js to almost full test coverage.

https://gerrit.wikimedia.org/r/1316138

Hi Everyone! I just wrapped up the last patch. In a branch which I have combined all my changes, here are the new test results:

File                                                | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------------------------------------------------|---------|----------|---------|---------|-------------------
All files                                           |   99.54 |     98.6 |   97.89 |   99.54 |                   
 ext.donationInterface.donorPortal                  |     100 |      100 |     100 |     100 |                   
  ApiUtils.js                                       |     100 |      100 |     100 |     100 |                   
  normalizeInput.js                                 |     100 |      100 |     100 |     100 |                   
  router.js                                         |     100 |      100 |     100 |     100 |                   
  trackingParams.js                                 |     100 |      100 |     100 |     100 |                   
 ext.donationInterface.donorPortal/components       |   99.28 |    98.76 |   96.95 |   99.28 |                   
  App.vue                                           |     100 |      100 |     100 |     100 |                   
  DonationsDisclaimerComponent.vue                  |     100 |      100 |     100 |     100 |                   
  DonationsHistory.vue                              |     100 |      100 |     100 |     100 |                   
  DonationsListTable.vue                            |     100 |      100 |     100 |     100 |                   
  DonorCardComponent.vue                            |     100 |      100 |     100 |     100 |                   
  DonorContactDetails.vue                           |     100 |      100 |     100 |     100 |                   
  EndowmentInformationComponent.vue                 |     100 |      100 |     100 |     100 |                   
  ErrorComponent.vue                                |     100 |      100 |     100 |     100 |                   
  FeedbackSurveyComponent.vue                       |     100 |      100 |     100 |     100 |                   
  GreetingComponent.vue                             |     100 |      100 |     100 |     100 |                   
  Header.vue                                        |     100 |      100 |     100 |     100 |                   
  OnetimeContribution.vue                           |     100 |      100 |     100 |     100 |                   
  PopupLink.vue                                     |     100 |      100 |     100 |     100 |                   
  RadioButtonInput.vue                              |     100 |      100 |     100 |     100 |                   
  RecurringContributionAnnualConversionForm.vue     |   98.83 |      100 |      95 |   98.83 | 19                
  RecurringContributionAnnualConversionSuccess.vue  |      96 |      100 |   83.33 |      96 | 17                
  RecurringContributionCancelAltOptionContainer.vue |     100 |      100 |     100 |     100 |                   
  RecurringContributionCancelConfirmation.vue       |   97.22 |      100 |      90 |   97.22 | 22                
  RecurringContributionCancelForm.vue               |   98.07 |      100 |   95.23 |   98.07 | 24                
  RecurringContributionCancelSuccess.vue            |     100 |      100 |     100 |     100 |                   
  RecurringContributionComponent.vue                |     100 |    93.33 |     100 |     100 | 199-200           
  RecurringContributionPauseForm.vue                |   97.14 |      100 |    87.5 |   97.14 | 22                
  RecurringContributionPauseSuccess.vue             |   94.44 |      100 |      75 |   94.44 | 17                
  RecurringContributionSummary.vue                  |     100 |      100 |     100 |     100 |                   
  RecurringContributionUpdateForm.vue               |     100 |      100 |     100 |     100 |                   
  RecurringContributionUpdateSuccess.vue            |     100 |      100 |     100 |     100 |                   
  RelatedContentComponent.vue                       |     100 |      100 |     100 |     100 |                   
 ext.donationInterface.donorPortal/views            |     100 |     97.5 |     100 |     100 |                   
  AmountDowngrade.vue                               |     100 |      100 |     100 |     100 |                   
  AnnualConversion.vue                              |     100 |      100 |     100 |     100 |                   
  CancelDonations.vue                               |     100 |    94.44 |     100 |     100 | 155               
  Home.vue                                          |     100 |      100 |     100 |     100 |                   
  LoginView.vue                                     |     100 |    97.36 |     100 |     100 | 202               
  ManageDonations.vue                               |     100 |      100 |     100 |     100 |                   
  PauseDonations.vue                                |     100 |       90 |     100 |     100 | 108               
  UpdateDonations.vue                               |     100 |      100 |     100 |     100 |                   
----------------------------------------------------|---------|----------|---------|---------|-------------------

You may notice that there are some test files which still are not at 100%, or still have uncovered lines. This was due to two reasons that I found while working on this ticket and I have created tickets for each of them:

1. Unused defaultValue() prop optionshttps://phabricator.wikimedia.org/T433148

Six components declare defaultValue() where Vue expects default(). defaultValue is not a valid prop option, so Vue never calls it and the function can never be covered.

filelinefunctions
RecurringContributionPauseSuccess.vue3075.0%
RecurringContributionAnnualConversionSuccess.vue4483.3%
RecurringContributionPauseForm.vue7787.5%
RecurringContributionCancelConfirmation.vue7990.0%
RecurringContributionCancelForm.vue11095.2%
RecurringContributionAnnualConversionForm.vue14595.0%

To fix this we can delete the definition from each file, or update it to default(), though since these props are all declared required: true I dont believe that is necessary.

2. Unreachable template brancheshttps://phabricator.wikimedia.org/T433149

v-if / v-else-if chains with no v-else compile to an implicit empty arm that cannot be reached.

filebranchesnote
RecurringContributionComponent.vue93.3%4 unused arms
PauseDonations.vue90.0%final v-else-if should be v-else
CancelDonations.vue94.4%final v-else-if should be v-else
LoginView.vue97.4%v-if="!server_error" nested inside a v-else that already guarantees it

Updating these to be v-else should bring the test files to 100%.

If there are any further questions, please let me know. Thanks!

Change #1312636 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated header.test.js to 100% coverage.

https://gerrit.wikimedia.org/r/1312636

Change #1316138 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated login.test.js to almost full test coverage.

https://gerrit.wikimedia.org/r/1316138

Laurabarluzzi changed the task status from Open to In Progress.Mon, Jul 27, 5:59 PM

Change #1314138 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated recurring-update-form.test.js to 100% test coverage

https://gerrit.wikimedia.org/r/1314138

Change #1315205 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Update manage-donations.test.js to 100% test coverage

https://gerrit.wikimedia.org/r/1315205

Change #1315225 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated pause-donations.test.js to almost full test coverage.

https://gerrit.wikimedia.org/r/1315225

Change #1315235 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Cover not-found and unknown-error branches in UpdateDonations view.

https://gerrit.wikimedia.org/r/1315235

Change #1316096 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Update cancel-donations.test.js to almost full test coverage.

https://gerrit.wikimedia.org/r/1316096

Change #1310693 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Updated router.js test coverage

https://gerrit.wikimedia.org/r/1310693

Change #1313269 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Cover the hidden switch to annual link in cancel confirmation

https://gerrit.wikimedia.org/r/1313269

XenoRyet set Final Story Points to 8.