Skip to content

Codebase Unit Test Coverage

lindsayJohnstonPnnl edited this page May 29, 2025 · 6 revisions

There is a milestone in GitHub for achieving 80% unit test coverage for the codebase. It didn't have a great place to put images or tables so I created this Wiki page as a supplement.

As of 3/11/25 there is less than 5% test coverage for Statements, Branches, Functions and Lines of code.

The goal is to get each number to at least 80% in the "All files" line of the report below.

From the root of the project run yarn test --coverage --watchAll=false to generate the test coverage report.

Starting Point - main branch - 3/11/25:

---------------------------------------------|---------|----------|---------|---------|--------------------------------
File                                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s              
---------------------------------------------|---------|----------|---------|---------|--------------------------------
All files                                    |   13.66 |     9.86 |   12.91 |   13.61 |                                
 src                                         |       0 |        0 |       0 |       0 |                                
  App.tsx                                    |       0 |      100 |       0 |       0 | 17-43                          
  index.tsx                                  |       0 |      100 |       0 |       0 | 8-31                           
  pdf-renderer.ts                            |       0 |        0 |       0 |       0 |                                
  reportWebVitals.ts                         |       0 |        0 |       0 |       0 | 3-11                           
  service-worker.ts                          |       0 |        0 |       0 |       0 | 18-76                          
  serviceWorkerRegistration.ts               |       0 |        0 |       0 |       0 | 13-144                         
 src/components                              |   17.76 |    16.71 |   16.77 |   17.64 |                                
  checkbox.tsx                               |       0 |        0 |       0 |       0 | 22-50                          
  checkbox_wrapper.tsx                       |       0 |        0 |       0 |       0 | 15-29                          
  climate_zone_select_wrapper.tsx            |       0 |      100 |       0 |       0 | 11-15                          
  collapsible.tsx                            |     100 |      100 |     100 |     100 |                                
  date_input.tsx                             |       0 |        0 |       0 |       0 | 10-18                          
  date_input_wrapper.tsx                     |       0 |        0 |       0 |       0 | 12-20                          
  date_str.tsx                               |       0 |        0 |       0 |       0 | 3-31                           
  date_time_str.tsx                          |      80 |       75 |     100 |      80 | 33                             
  figure_wrapper.tsx                         |       0 |      100 |       0 |       0 | 9-10                           
  file_input.tsx                             |       0 |        0 |       0 |       0 | 16-70                          
  file_input_wrapper.tsx                     |       0 |        0 |       0 |       0 | 14-36                          
  gps_coord_str.tsx                          |      75 |       75 |     100 |      75 | 11                             
  installation_select_wrapper.tsx            |       0 |        0 |       0 |       0 | 20-59                          
  label_value.tsx                            |       0 |        0 |       0 |       0 | 11-36                          
  label_value_wrapper.tsx                    |       0 |        0 |       0 |       0 | 18-34                          
  location_str.tsx                           |      50 |        0 |       0 |      50 | 11                             
  mdx_wrapper.tsx                            |       0 |        0 |       0 |       0 | 41-86                          
  number_input.tsx                           |       0 |        0 |       0 |       0 | 18-96                          
  number_input_wrapper.tsx                   |       0 |        0 |       0 |       0 | 18-41                          
  page_break.tsx                             |       0 |      100 |       0 |       0 | 3-4                            
  pdf_renderer.tsx                           |       0 |        0 |       0 |       0 | 5-27                           
  pdf_renderer_wrapper.tsx                   |       0 |        0 |       0 |       0 | 11-23                          
  photo.tsx                                  |       0 |        0 |       0 |       0 | 16-124                         
  photo_input.tsx                            |   88.88 |    70.27 |   85.71 |   88.88 | 68,86,97-121                   
  photo_input_wrapper.tsx                    |       0 |        0 |       0 |       0 | 21-76                          
  photo_wrapper.tsx                          |       0 |        0 |       0 |       0 | 18-28                          
  print_section wrapper.tsx                  |       0 |      100 |       0 |       0 | 10-14                          
  print_section.tsx                          |       0 |        0 |       0 |       0 | 10-35                          
  radio.tsx                                  |       0 |      100 |       0 |       0 | 11-27                          
  radio_wrapper.tsx                          |       0 |        0 |       0 |       0 | 13-25                          
  repeatable.tsx                             |       0 |      100 |       0 |       0 | 11-15                          
  repeatable_input.tsx                       |       0 |        0 |       0 |       0 | 19-79                          
  repeatable_input_wrapper.tsx               |       0 |        0 |       0 |       0 | 20-190                         
  repeatable_wrapper.tsx                     |       0 |        0 |       0 |       0 | 12-19                          
  select.tsx                                 |       0 |        0 |       0 |       0 | 11-33                          
  select_wrapper.tsx                         |       0 |        0 |       0 |       0 | 22-35                          
  show_or_hide.tsx                           |   66.66 |    76.47 |   66.66 |      75 | 32-35,40                       
  show_or_hide_wrapper.tsx                   |       0 |        0 |       0 |       0 | 18-35                          
  string_input.tsx                           |       0 |        0 |       0 |       0 | 16-68                          
  string_input_wrapper.tsx                   |       0 |        0 |       0 |       0 | 16-35                          
  tab_wrapper.tsx                            |       0 |      100 |       0 |       0 | 10-15                          
  table_wrapper.tsx                          |       0 |      100 |       0 |       0 | 8-9                            
  text_input.tsx                             |      50 |    36.36 |      40 |      50 | 33,37,46-63,71,79,96-97        
  text_input_wrapper.tsx                     |      75 |       20 |   66.66 |      75 | 35                             
  us_state_select_wrapper.tsx                |       0 |      100 |       0 |       0 | 11-15                          
 src/components/views/installations/edit     |       0 |        0 |       0 |       0 |                                
  index.tsx                                  |       0 |      100 |       0 |       0 | 11-18                          
  mdx_template_view.tsx                      |       0 |        0 |       0 |       0 | 15-51                          
 src/components/views/installations/list     |       0 |        0 |       0 |       0 |                                
  index.tsx                                  |       0 |      100 |       0 |       0 | 14-20                          
  installation_list_group.tsx                |       0 |        0 |       0 |       0 | 13-43                          
  jobs_view.tsx                              |       0 |        0 |       0 |       0 | 31-278                         
 src/components/views/layouts/default        |   57.89 |    28.57 |     100 |   57.89 |                                
  index.tsx                                  |   57.89 |    28.57 |     100 |   57.89 | 15-26,32                       
 src/components/views/projects/edit          |       0 |        0 |       0 |       0 |                                
  index.tsx                                  |       0 |      100 |       0 |       0 | 9-14                           
  mdx_project_details_view.tsx               |       0 |        0 |       0 |       0 | 12-32                          
 src/components/views/projects/list          |   29.31 |    16.21 |   18.42 |   29.31 |                                
  export_document.tsx                        |    8.33 |      100 |       0 |    8.33 | 20-44                          
  home.tsx                                   |   34.48 |    41.66 |   15.38 |   34.48 | 49,55,62,82-92,103-114,133-267 
  import_document.tsx                        |   37.03 |       10 |      40 |   37.03 | 29-44,53-75,83                 
  index.tsx                                  |     100 |      100 |     100 |     100 |                                
  project_list_group.tsx                     |    5.88 |        0 |       0 |    5.88 | 24-60                          
 src/components/views/projects/show          |       0 |        0 |       0 |       0 |                                
  index.tsx                                  |       0 |      100 |       0 |       0 | 10-15                          
  templates_list_group.tsx                   |       0 |        0 |       0 |       0 | 14-48                          
  workflow_view.tsx                          |       0 |        0 |       0 |       0 | 11-40                          
 src/components/views/shared                 |   41.66 |     9.09 |   27.27 |   41.66 |                                
  delete_confirmation_modal.tsx              |   35.71 |        0 |      25 |   35.71 | 21-26,33-38,44                 
  string_input_modal.tsx                     |   45.45 |     12.5 |   28.57 |   45.45 | 39-44,51,58-63,69,74-75        
 src/migrations                              |    4.76 |        0 |       0 |    4.76 |                                
  0_doe_combustion_appliance_safety_tests.ts |       0 |        0 |       0 |       0 | 32-216                         
  index.ts                                   |   18.18 |        0 |       0 |   18.18 | 28-46                          
 src/providers                               |   14.45 |     4.41 |   14.58 |   14.45 |                                
  database_provider.tsx                      |    87.5 |       50 |     100 |    87.5 | 12                             
  installation_provider.tsx                  |       0 |        0 |       0 |       0 | 17-128                         
  installations_provider.tsx                 |       0 |        0 |       0 |       0 | 18-110                         
  project_provider.tsx                       |       0 |        0 |       0 |       0 | 17-128                         
  projects_provider.tsx                      |   68.18 |    33.33 |   66.66 |   68.18 | 27-30,68-73,87                 
  store_provider.tsx                         |    5.12 |        0 |       0 |    5.12 | 15-24,47-59,76-209             
  workflow_provider.tsx                      |       0 |        0 |       0 |       0 | 5-29                           
 src/templates                               |       0 |        0 |       0 |       0 |                                
  index.ts                                   |       0 |        0 |       0 |       0 | 44-141                         
 src/types                                   |       0 |      100 |     100 |       0 |                                
  database.types.ts                          |       0 |        0 |       0 |       0 |                                
  geolocation.type.ts                        |       0 |        0 |       0 |       0 |                                
  iecc_climate_zone.type.ts                  |       0 |      100 |     100 |       0 | 1                              
  installer.type.ts                          |       0 |        0 |       0 |       0 |                                
  location.type.ts                           |       0 |        0 |       0 |       0 |                                
  timestamp.type.ts                          |       0 |        0 |       0 |       0 |                                
  us_state.type.ts                           |       0 |      100 |     100 |       0 | 1                              
 src/utilities                               |    5.76 |     1.51 |    7.69 |    5.76 |                                
  blob_utils.ts                              |       0 |      100 |       0 |       0 | 2-21                           
  cloning_utils.ts                           |       0 |        0 |       0 |       0 | 6-66                           
  comparison_utils.ts                        |   14.28 |    33.33 |      20 |   14.28 | 15-32,36-40,44-51              
  database_utils.ts                          |    2.67 |        0 |    4.34 |    2.67 | 22-346,357-486                 
  json_serialization_utils.ts                |    2.32 |        0 |       0 |    2.32 | 43-292                         
  location_utils.ts                          |       0 |        0 |       0 |       0 | 4-18                           
  path_utils.ts                              |       0 |        0 |       0 |       0 | 10-47                          
  photo_attachment_utils.ts                  |       0 |        0 |       0 |       0 | 16-56                          
  photo_utils.ts                             |   22.22 |        0 |       0 |   22.22 | 48-137                         
  regexp_utils.ts                            |       0 |      100 |       0 |       0 | 2                              
  validation_utils.ts                        |      75 |      100 |      75 |      75 | 4                              
---------------------------------------------|---------|----------|---------|---------|--------------------------------

Test Suites: 1 failed, 2 passed, 3 total
Tests:       13 passed, 13 total
Snapshots:   0 total
Time:        10.782 s
Ran all test suites.

Current Test Coverage (5/29/2025):

File                                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s  
---------------------------------------------|---------|----------|---------|---------|--------------------
All files                                    |    7.42 |     6.92 |     6.6 |    7.36 |                    
 src                                         |       0 |        0 |       0 |       0 |                    
  App.tsx                                    |       0 |      100 |       0 |       0 | 18-55              
  index.tsx                                  |       0 |      100 |       0 |       0 | 8-31               
  pdf-renderer.ts                            |       0 |        0 |       0 |       0 |                    
  reportWebVitals.ts                         |       0 |        0 |       0 |       0 | 3-11               
  service-worker.ts                          |       0 |        0 |       0 |       0 | 18-76              
  serviceWorkerRegistration.ts               |       0 |        0 |       0 |       0 | 13-152             
 src/components                              |   19.74 |    17.36 |   19.04 |   19.63 |                    
  checkbox.tsx                               |     100 |      100 |     100 |     100 |                    
  checkbox_wrapper.tsx                       |       0 |        0 |       0 |       0 | 15-30              
  climate_zone_select_wrapper.tsx            |       0 |      100 |       0 |       0 | 11-15              
  collapsible.tsx                            |     100 |      100 |     100 |     100 |                    
  date_input.tsx                             |       0 |      100 |       0 |       0 | 10-18              
  date_input_wrapper.tsx                     |       0 |        0 |       0 |       0 | 12-21              
  date_str.tsx                               |       0 |        0 |       0 |       0 | 3-31               
  date_time_str.tsx                          |      80 |       75 |     100 |      80 | 33                 
  figure_wrapper.tsx                         |       0 |      100 |       0 |       0 | 9-10               
  file_input.tsx                             |       0 |        0 |       0 |       0 | 16-70              
  file_input_wrapper.tsx                     |       0 |        0 |       0 |       0 | 14-36              
  gps_coord_str.tsx                          |      75 |       75 |     100 |      75 | 11                 
  installation_select_wrapper.tsx            |       0 |        0 |       0 |       0 | 20-59              
  label_value.tsx                            |       0 |        0 |       0 |       0 | 11-36              
  label_value_wrapper.tsx                    |       0 |        0 |       0 |       0 | 18-34              
  location_str.tsx                           |      50 |        0 |       0 |      50 | 11                 
  mdx_wrapper.tsx                            |       0 |        0 |       0 |       0 | 48-99              
  number_input.tsx                           |       0 |        0 |       0 |       0 | 17-52              
  number_input_wrapper.tsx                   |       0 |        0 |       0 |       0 | 12-97              
  page_break.tsx                             |       0 |      100 |       0 |       0 | 3-4                
  pdf_renderer.tsx                           |       0 |        0 |       0 |       0 | 5-27               
  pdf_renderer_wrapper.tsx                   |       0 |        0 |       0 |       0 | 11-23              
  photo.tsx                                  |       0 |        0 |       0 |       0 | 16-124             
  photo_input.tsx                            |   88.88 |    70.27 |   85.71 |   88.88 | 68,86,97-121       
  photo_input_wrapper.tsx                    |       0 |        0 |       0 |       0 | 19-65              
  photo_wrapper.tsx                          |       0 |        0 |       0 |       0 | 18-28              
  print_section wrapper.tsx                  |       0 |      100 |       0 |       0 | 10-14              
  print_section.tsx                          |       0 |        0 |       0 |       0 | 10-35              
  radio.tsx                                  |       0 |      100 |       0 |       0 | 11-27              
  radio_wrapper.tsx                          |       0 |        0 |       0 |       0 | 13-26              
  repeatable.tsx                             |       0 |      100 |       0 |       0 | 11-15              
  repeatable_input.tsx                       |       0 |        0 |       0 |       0 | 19-79              
  repeatable_input_wrapper.tsx               |       0 |        0 |       0 |       0 | 20-220             
  repeatable_wrapper.tsx                     |       0 |        0 |       0 |       0 | 12-19              
  select.tsx                                 |       0 |        0 |       0 |       0 | 11-33              
  select_wrapper.tsx                         |       0 |        0 |       0 |       0 | 22-36              
  show_or_hide.tsx                           |   66.66 |    76.47 |   66.66 |      75 | 32-35,40           
  show_or_hide_wrapper.tsx                   |       0 |        0 |       0 |       0 | 18-35              
  string_input.tsx                           |       0 |        0 |       0 |       0 | 12-28              
  string_input_wrapper.tsx                   |       0 |        0 |       0 |       0 | 17-68              
  tab_wrapper.tsx                            |       0 |      100 |       0 |       0 | 10-15              
  table_wrapper.tsx                          |       0 |      100 |       0 |       0 | 8-9                
  text_input.tsx                             |   66.66 |     62.5 |      40 |   66.66 | 27,31,39,56-57     
  text_input_wrapper.tsx                     |   33.33 |    19.04 |   42.85 |   33.33 | 28-45,68           
  us_state_select_wrapper.tsx                |       0 |      100 |       0 |       0 | 11-15              
 src/components/views/installations/edit     |       0 |        0 |       0 |       0 |                    
  index.tsx                                  |       0 |      100 |       0 |       0 | 11-18              
  mdx_template_view.tsx                      |       0 |        0 |       0 |       0 | 15-54              
 src/components/views/installations/list     |       0 |        0 |       0 |       0 |                    
  index.tsx                                  |       0 |      100 |       0 |       0 | 14-20              
  installation_list_group.tsx                |       0 |        0 |       0 |       0 | 13-43              
  jobs_view.tsx                              |       0 |        0 |       0 |       0 | 31-283             
 src/components/views/layouts/default        |   10.52 |        0 |       0 |   10.52 |                    
  index.tsx                                  |   10.52 |        0 |       0 |   10.52 | 9-32,41-47         
 src/components/views/projects/edit          |       0 |        0 |       0 |       0 |                    
  index.tsx                                  |       0 |      100 |       0 |       0 | 9-14               
  mdx_project_details_view.tsx               |       0 |        0 |       0 |       0 | 15-106             
 src/components/views/projects/list          |    6.75 |        0 |       0 |    6.75 |                    
  export_document.tsx                        |    8.33 |      100 |       0 |    8.33 | 20-44              
  home.tsx                                   |    4.76 |        0 |       0 |    4.76 | 18-127             
  import_document.tsx                        |     3.7 |        0 |       0 |     3.7 | 19-83              
  index.tsx                                  |      50 |      100 |       0 |      50 | 11                 
  project_list_group.tsx                     |    8.33 |        0 |       0 |    8.33 | 22-46              
 src/components/views/projects/new           |       0 |        0 |       0 |       0 |                    
  index.tsx                                  |       0 |      100 |       0 |       0 | 6-7                
  mdx_project_details_view.tsx               |       0 |        0 |       0 |       0 | 22-116             
 src/components/views/projects/show          |       0 |        0 |       0 |       0 |                    
  index.tsx                                  |       0 |      100 |       0 |       0 | 10-15              
  templates_list_group.tsx                   |       0 |        0 |       0 |       0 | 14-48              
  workflow_view.tsx                          |       0 |        0 |       0 |       0 | 11-40              
 src/components/views/shared                 |    1.58 |        0 |       0 |    1.58 |                    
  delete_confirmation_modal.tsx              |    7.14 |        0 |       0 |    7.14 | 19-47              
  doc_name_input_wrapper.tsx                 |       0 |        0 |       0 |       0 | 11-96              
  string_input_modal.tsx                     |       0 |        0 |       0 |       0 | 19-85              
 src/hooks                                   |       0 |        0 |       0 |       0 |                    
  useEditableInstallation.ts                 |       0 |        0 |       0 |       0 | 19-78              
  useEditableProject.ts                      |       0 |        0 |       0 |       0 | 16-74              
 src/migrations                              |    5.26 |        0 |       0 |    5.26 |                    
  0_doe_combustion_appliance_safety_tests.ts |    2.63 |        0 |       0 |    2.63 | 52-268             
  1_photo_attachment_id_suffixes.ts          |     3.7 |        0 |       0 |     3.7 | 20-116             
  index.ts                                   |   18.18 |        0 |       0 |   18.18 | 30-48              
 src/providers                               |    4.62 |     1.35 |       0 |    4.62 |                    
  database_provider.tsx                      |      50 |       50 |       0 |      50 | 12,22-34           
  installation_provider.tsx                  |       0 |        0 |       0 |       0 | 17-128             
  installations_provider.tsx                 |       0 |        0 |       0 |       0 | 18-110             
  project_provider.tsx                       |       0 |        0 |       0 |       0 | 17-128             
  projects_provider.tsx                      |    9.09 |        0 |       0 |    9.09 | 27-39,53-93        
  store_provider.tsx                         |    4.34 |        0 |       0 |    4.34 | 24-33,64-76,93-267 
  workflow_provider.tsx                      |       0 |        0 |       0 |       0 | 5-29               
 src/templates                               |       0 |        0 |       0 |       0 |                    
  index.ts                                   |       0 |        0 |       0 |       0 | 51-192             
 src/types                                   |       0 |      100 |     100 |       0 |                    
  database.types.ts                          |       0 |        0 |       0 |       0 |                    
  geolocation.type.ts                        |       0 |        0 |       0 |       0 |                    
  iecc_climate_zone.type.ts                  |       0 |      100 |     100 |       0 | 1                  
  installer.type.ts                          |       0 |        0 |       0 |       0 |                    
  location.type.ts                           |       0 |        0 |       0 |       0 |                    
  timestamp.type.ts                          |       0 |        0 |       0 |       0 |                    
  us_state.type.ts                           |       0 |      100 |     100 |       0 | 1                  
 src/utilities                               |    2.97 |        0 |       0 |    2.97 |                    
  blob_utils.ts                              |       0 |      100 |       0 |       0 | 2-21               
  cloning_utils.ts                           |       0 |        0 |       0 |       0 | 6-66               
  comparison_utils.ts                        |       0 |        0 |       0 |       0 | 13-51              
  database_utils.ts                          |    1.65 |        0 |       0 |    1.65 | 25-552             
  equality_utils.ts                          |       0 |        0 |       0 |       0 | 10-80              
  json_serialization_utils.ts                |     2.1 |        0 |       0 |     2.1 | 45-333             
  location_utils.ts                          |       0 |        0 |       0 |       0 | 4-18               
  path_utils.ts                              |       0 |        0 |       0 |       0 | 10-49              
  photo_attachment_utils.ts                  |       0 |        0 |       0 |       0 | 16-56              
  photo_utils.ts                             |   22.22 |        0 |       0 |   22.22 | 48-137             
  regexp_utils.ts                            |       0 |      100 |       0 |       0 | 2                  
  validation_utils.ts                        |       0 |        0 |       0 |       0 | 5-51               
---------------------------------------------|---------|----------|---------|---------|--------------------

Test Suites: 4 passed, 4 total
Tests:       20 passed, 20 total
Snapshots:   0 total
Time:        2.882 s

Clone this wiki locally