Skip to content

Test coverage#668

Merged
gogonzo merged 9 commits intomainfrom
test_coverage
Nov 7, 2025
Merged

Test coverage#668
gogonzo merged 9 commits intomainfrom
test_coverage

Conversation

@gogonzo
Copy link
Copy Markdown
Contributor

@gogonzo gogonzo commented Nov 6, 2025

Increate test coverage to 80%.
During testing I've found some redundant code which could be optimized.

@gogonzo gogonzo linked an issue Nov 6, 2025 that may be closed by this pull request
@gogonzo gogonzo added the core label Nov 6, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 6, 2025

badge

Code Coverage Summary

Filename                        Stmts    Miss  Cover    Missing
----------------------------  -------  ------  -------  -------------------------------------------------------------------------------------------------------------------------
R/calls_combine_by.R                7       0  100.00%
R/choices_labeled.R                23       1  95.65%   34
R/count_labels.R                  126       0  100.00%
R/filter_panel_api.R               27       1  96.30%   132
R/FilteredData-utils.R             58      17  70.69%   38-43, 139, 161-170
R/FilteredData.R                  522     118  77.39%   109, 138, 186, 325, 397, 484-493, 514, 532-590, 610-613, 657, 712-728, 873, 885-905
R/FilteredDataset-utils.R          23       1  95.65%   125
R/FilteredDataset.R               264       5  98.11%   49, 154, 189, 214-215
R/FilteredDatasetDataframe.R      123       3  97.56%   87, 148, 158
R/FilteredDatasetDefault.R         18       4  77.78%   104-117
R/FilteredDatasetMAE.R            133      15  88.72%   56, 118-123, 160-165, 169-170
R/FilterPanelAPI.R                 10       0  100.00%
R/FilterState-utils.R             101       2  98.02%   264, 294
R/FilterState.R                   366      21  94.26%   91, 155, 266-267, 273-274, 328, 330, 416, 632, 675-679, 698, 762-768, 779
R/FilterStateChoices.R            349      10  97.13%   303, 426-429, 541-544, 589
R/FilterStateDate.R               221      46  79.19%   233, 361-371, 382-387, 391-396, 404-419, 438-445
R/FilterStateDatettime.R          316     206  34.81%   269, 321-559
R/FilterStateEmpty.R               53      31  41.51%   89, 99-104, 117, 129-169
R/FilterStateExpr.R                81       1  98.77%   244
R/FilterStateLogical.R            201     149  25.87%   139, 161, 221, 225-414
R/FilterStateRange.R              409     121  70.42%   265, 387, 498-505, 508-518, 521, 532-538, 549-561, 565-575, 579-581, 594-620, 635-642, 645-652, 666-683, 718-723, 733-735
R/FilterStates-utils.R             70       7  90.00%   108, 127, 188-194
R/FilterStates.R                  379      19  94.99%   63, 92-96, 208, 425, 470, 559-563, 608, 726-729
R/FilterStatesDF.R                  5       0  100.00%
R/FilterStatesMAE.R                10       1  90.00%   40
R/FilterStatesMatrix.R              7       0  100.00%
R/FilterStatesSE.R                171      47  72.51%   36, 73-75, 85-87, 119, 191-201, 213-223, 230-237, 245-252, 259
R/include_css_js.R                  5       0  100.00%
R/teal_slice.R                    108       1  99.07%   206
R/teal_slices.R                    85       5  94.12%   150-155
R/test_utils.R                     21       0  100.00%
R/utils.R                          29       0  100.00%
R/variable_types.R                 15       1  93.33%   48
R/zzz.R                            16      16  0.00%    3-46
TOTAL                            4352     849  80.49%

Diff against main

Filename                  Stmts    Miss  Cover
----------------------  -------  ------  -------
R/choices_labeled.R         -26     -13  +24.22%
R/FilteredData.R              0     -65  +12.45%
R/FilterState.R               0     -41  +11.20%
R/FilterStateChoices.R      -10    -106  +29.45%
R/FilterStateDate.R           0     -89  +40.27%
R/FilterStateExpr.R           0     -65  +80.25%
R/FilterStatesSE.R            0     +11  -6.43%
R/teal_slice.R                0      -3  +2.78%
TOTAL                       -36    -371  +8.29%

Results for commit: 29aca26

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 6, 2025

Unit Tests Summary

  1 files   31 suites   40s ⏱️
409 tests 394 ✅ 15 💤 0 ❌
871 runs  856 ✅ 15 💤 0 ❌

Results for commit 29aca26.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 6, 2025

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
FilteredData 💔 $12.13$ $+11.30$ $+34$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
FilteredData 👶 $+0.10$ srv_overview_srv_overview_produces_table_with_filtered_counts_of_non_relational_datasets
FilteredData 👶 $+0.11$ srv_overview_srv_overview_produces_table_with_filtered_counts_of_relational_datasets
FilteredData 👶 $+0.04$ srv_overview_srv_overview_produces_table_with_popover_information_for_unsupported_dataset_class
FilteredData 👶 $+0.05$ srv_overview_srv_overview_returns_NULL_when_active_dataset_returns_nothing
FilteredData 👶 $+0.49$ test_ChoicesFilterState_server_setting_input_selection_changes_filter_state_pickerInput_
FilteredData 👶 $+0.47$ test_ChoicesFilterState_server_setting_input_selection_changes_filter_state_radioButton_
FilteredData 👶 $+0.50$ test_ChoicesFilterState_server_setting_input_selection_has_no_effect_on_filter_state_when_fixed_TRUE
FilteredData 👶 $+0.46$ test_ChoicesFilterState_server_setting_many_input_selection_when_multiple_FALSE_is_ignored_with_warning_pickerInput_
FilteredData 👶 $+0.45$ test_ChoicesFilterState_server_setting_many_input_selection_when_multiple_FALSE_is_ignored_with_warning_radioInput_
FilteredData 👶 $+0.47$ test_ChoicesFilterState_server_summary_displays_n_levels_selected_when_selected_exceeds_40_characters
FilteredData 👶 $+0.45$ test_ChoicesFilterState_server_summary_displays_no_selection_when_nothing_is_selected
FilteredData 👶 $+0.45$ test_ChoicesFilterState_server_summary_displays_selected_choices_as_text
FilteredData 👶 $+0.46$ test_DateFilterState_server_setting_input_changes_filter_state_selected
FilteredData 👶 $+0.45$ test_DateFilterState_server_summary_displays_selected_date_range_as_text
FilteredData 👶 $+0.48$ test_FilterStateExpr_server_FilterStateExpr_can_be_mixed_with_other_FilterState_types
FilteredData 👶 $+0.39$ test_FilterStateExpr_server_FilterStateExpr_is_executed_and_produces_filtered_data
FilteredData 👶 $+0.37$ test_FilterStateExpr_server_input_remove_has_no_effect_when_filter_is_anchored
FilteredData 👶 $+0.49$ test_FilterStateExpr_server_input_remove_removes_filter_from_states
FilteredData 👶 $+0.42$ test_FilterStateExpr_server_multiple_FilterStateExpr_filters_can_coexist_for_the_same_varname
FilteredData 👶 $+0.39$ test_FilterStateExpr_server_summary_displays_expression_as_text
FilteredData 👶 $+0.54$ test_FilterState_server_input_back_restores_previous_filter_selection
FilteredData 👶 $+0.64$ test_FilterState_server_input_remove_removes_filter_from_states
FilteredData 👶 $+0.58$ test_FilterState_server_input_reset_restores_initial_filter_selection
FilteredData 👶 $+1.08$ test_FilterState_server_setting_input_keep_na_value_reflects_in_filter_state
FilteredData 👶 $+0.63$ test_RangeFilterState_summary_displays_selected_numeric_range_as_text

Results for commit 21637a6

♻️ This comment has been updated with latest results.

@gogonzo
Copy link
Copy Markdown
Contributor Author

gogonzo commented Nov 6, 2025

Funny that locally it had better coverage... I will continue here to reach 80%

@osenan osenan self-assigned this Nov 6, 2025
Comment thread DESCRIPTION Outdated
Copy link
Copy Markdown
Contributor

@osenan osenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

I've checked the coverage report and we achieved the goal. Thanks to the changes the code seems better. I liked the tests, they are very helpful to understand the functions tested.

I put comments on the way we process the html table output to generate a data.frame. I think having too many function calls within the same line is not optimal for interpreting the code. That is why I recommend to put every action with a pipe and if the pipe is repeated to create a helper function.

Comment thread R/choices_labeled.R
Comment thread tests/testthat/test-FilteredData.R Outdated
Comment thread tests/testthat/test-FilteredData.R
@gogonzo gogonzo enabled auto-merge (squash) November 7, 2025 08:09
@gogonzo gogonzo merged commit 205932a into main Nov 7, 2025
29 checks passed
@gogonzo gogonzo deleted the test_coverage branch November 7, 2025 10:13
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Update unit test coverage to be at min 80% coverage

3 participants